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): class ErrorHandler(object):
@staticmethod @staticmethod
def _handle_error(resp): def _handle_error(resp):
error_state = resp['@error'] error = resp.get('error')
if error_state == 'false': if not error:
return return
error = resp['error']
code = error['code'] code = error['code']
msg = error['msg'] msg = error['msg']
template = 'Error {code}: {msg}' template = 'Error {code}: {msg}'