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:
@@ -42,6 +42,10 @@ class Response(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def deserialized_content(self):
|
def deserialized_content(self):
|
||||||
if not self._deserialized and self.content:
|
try:
|
||||||
self._deserialized = json.loads(self.content)
|
if not self._deserialized and self.content:
|
||||||
return self._deserialized
|
self._deserialized = json.loads(self.content)
|
||||||
|
return self._deserialized
|
||||||
|
except ValueError as ex:
|
||||||
|
print("Response is not a JSON object.", ex)
|
||||||
|
return None
|
||||||
|
Reference in New Issue
Block a user