Skip to content
Snippets Groups Projects
Commit 727a7246 authored by Gavin M. Roy's avatar Gavin M. Roy
Browse files

Fix the interpreting of aws errors

parent 660b34bb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,11 +3,15 @@
Version History
===============
 
0.7.2 (2017-06-03)
0.7.3 (2017-06-06)
------------------
- The error was introduced in 0.7.1, redeclaring ``error``. Fix that.
0.7.2 (2017-06-06)
------------------
- What type of error is it if it has no response? Odd.
 
0.7.1 (2017-06-02)
0.7.1 (2017-06-05)
------------------
- Getting error response back that we can't decode, log it
 
Loading
Loading
Loading
Loading
@@ -39,7 +39,7 @@ def read_requirements(name):
 
setuptools.setup(
name='tornado-aws',
version='0.7.2',
version='0.7.3',
description=DESC,
long_description=open('README.rst').read(),
author='Gavin M. Roy',
Loading
Loading
Loading
Loading
@@ -6,6 +6,6 @@ from tornado_aws.client import AWSClient
from tornado_aws.client import AsyncAWSClient
from tornado_aws.client import exceptions
 
__version__ = '0.7.2'
__version__ = '0.7.3'
 
__all__ = ['AWSClient', 'AsyncAWSClient', 'exceptions']
Loading
Loading
@@ -183,15 +183,13 @@ class AWSClient(object):
"""
if not isinstance(error, httpclient.HTTPError):
return
elif not hasattr(error, 'response'):
LOGGER.error('Error has no response: %r', error)
return
if error.code == 400:
if error.code >= 400 and error.response is not None:
try:
payload = json.loads(error.response.body.decode('utf-8'))
except json.JSONDecodeError as error:
LOGGER.error('Error decoding response: %r [%r]',
error.response, error.response.body)
except (AttributeError, json.JSONDecodeError) as err:
LOGGER.error('Error decoding response as JSON (%s): %r %r',
err, error.response,
getattr(error.response, 'body', None))
return
if isinstance(payload, dict) and '__type' in payload:
return payload
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment