Don't try and decode an empty body
This commit is contained in:
@@ -103,10 +103,11 @@ class Connection(object):
|
|||||||
error_message = raw_data
|
error_message = raw_data
|
||||||
additional_info = None
|
additional_info = None
|
||||||
try:
|
try:
|
||||||
additional_info = json.loads(raw_data)
|
if raw_data:
|
||||||
error_message = additional_info.get('error', error_message)
|
additional_info = json.loads(raw_data)
|
||||||
if isinstance(error_message, dict) and 'type' in error_message:
|
error_message = additional_info.get('error', error_message)
|
||||||
error_message = error_message['type']
|
if isinstance(error_message, dict) and 'type' in error_message:
|
||||||
|
error_message = error_message['type']
|
||||||
except (ValueError, TypeError) as err:
|
except (ValueError, TypeError) as err:
|
||||||
logger.warning('Undecodable raw error response from server: %s', err)
|
logger.warning('Undecodable raw error response from server: %s', err)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user