Improve error handling for ansible-core-ci. (#17734)
This commit is contained in:
parent
1384270ccd
commit
2e0bec293c
1 changed files with 4 additions and 1 deletions
|
@ -359,7 +359,10 @@ class HttpResponse:
|
||||||
self.response = response
|
self.response = response
|
||||||
|
|
||||||
def json(self):
|
def json(self):
|
||||||
return json.loads(self.response)
|
try:
|
||||||
|
return json.loads(self.response)
|
||||||
|
except ValueError:
|
||||||
|
raise ValueError('Cannot parse response as JSON:\n%s' % self.response)
|
||||||
|
|
||||||
|
|
||||||
requests = HttpRequest()
|
requests = HttpRequest()
|
||||||
|
|
Loading…
Reference in a new issue