From 5219e025e9a6d8b9401f17e1de7e042f47e651a8 Mon Sep 17 00:00:00 2001 From: "Gavin M. Roy" Date: Thu, 24 Mar 2016 16:42:29 -0400 Subject: [PATCH] Actually raise an exception --- sprockets/clients/dynamodb/connector.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sprockets/clients/dynamodb/connector.py b/sprockets/clients/dynamodb/connector.py index 89a4393..5a0882b 100644 --- a/sprockets/clients/dynamodb/connector.py +++ b/sprockets/clients/dynamodb/connector.py @@ -104,11 +104,12 @@ class DynamoDB(object): if http_err.code == 599: future.set_exception(exceptions.TimeoutException()) else: - response_reason = http_err.code + response_reason = str(http_err.code) if http_err.response and \ hasattr(http_err.response, 'body'): response_reason = http_err.response.body - future.set_exception(response_reason) + future.set_exception( + exceptions.RequestException(response_reason)) except Exception as exception: future.set_exception(exception) else: @@ -129,10 +130,11 @@ class DynamoDB(object): if err.code == 599: future.set_exception(exceptions.TimeoutException()) else: - reason = err.code + reason = str(err.code) if err.response and hasattr(err.response, 'body'): reason = err.response.body - future.set_exception(reason) + future.set_exception(exceptions.RequestException(reason)) + else: ioloop.IOLoop.current().add_future(aws_response, handle_response) return future