Rely on presence of 'error' element to detect errors.

This commit is contained in:
Jason R. Coombs 2016-09-03 11:50:15 -04:00
parent 35cc9e035d
commit 412a04b16b

View File

@ -57,11 +57,10 @@ class Client(object):
class ErrorHandler(object):
@staticmethod
def _handle_error(resp):
error_state = resp['@error']
if error_state == 'false':
error = resp.get('error')
if not error:
return
error = resp['error']
code = error['code']
msg = error['msg']
template = 'Error {code}: {msg}'