@classmethod<EOL><INDENT>def exception(cls, method, uri, response, message):<DEDENT>
<EOL>try:<EOL><INDENT>error_payload = json.loads(response.text)<EOL>if '<STR_LIT:message>' in error_payload:<EOL><INDENT>message = '<STR_LIT>'.format(message, error_payload['<STR_LIT:message>'])<EOL><DEDENT>code = error_payload.get('<STR_LIT:code>', response.status_code)<EOL>return TwilioRestException(response.status_code, uri, message, code, method)<EOL><DEDENT>except Exception:<EOL><INDENT>return TwilioRestException(response.status_code, uri, message, response.status_code, method)<EOL><DEDENT>
Wraps an exceptional response in a `TwilioRestException`.