Handling exception on 504 Error
When load balancer/proxy return 504, client raises ValueError. This happen when response is not a JSON object. ValueError Exception is needed to be handled. Change-Id: Iaa8d577f99137327f6e7ad9c7c6abc350f4cc938 Closes-Bug: #1358889
This commit is contained in:
parent
2acbced0ea
commit
ff13b7a6ac
|
@ -42,6 +42,10 @@ class Response(object):
|
|||
|
||||
@property
|
||||
def deserialized_content(self):
|
||||
if not self._deserialized and self.content:
|
||||
self._deserialized = json.loads(self.content)
|
||||
return self._deserialized
|
||||
try:
|
||||
if not self._deserialized and self.content:
|
||||
self._deserialized = json.loads(self.content)
|
||||
return self._deserialized
|
||||
except ValueError as ex:
|
||||
print("Response is not a JSON object.", ex)
|
||||
return None
|
||||
|
|
Loading…
Reference in New Issue