diff --git a/sprockets/clients/dynamodb/__init__.py b/sprockets/clients/dynamodb/__init__.py index 2d8b9db..e785d52 100644 --- a/sprockets/clients/dynamodb/__init__.py +++ b/sprockets/clients/dynamodb/__init__.py @@ -4,7 +4,7 @@ except ImportError as error: def DynamoDB(*args, **kwargs): raise error -version_info = (0, 3, 1) +version_info = (0, 3, 2) __version__ = '.'.join(str(v) for v in version_info) # Response constants diff --git a/sprockets/clients/dynamodb/connector.py b/sprockets/clients/dynamodb/connector.py index d9222ed..ac4475d 100644 --- a/sprockets/clients/dynamodb/connector.py +++ b/sprockets/clients/dynamodb/connector.py @@ -1,7 +1,9 @@ import json import logging import os +import select import socket +import ssl from tornado import concurrent, httpclient, ioloop import tornado_aws @@ -10,7 +12,7 @@ from tornado_aws import exceptions as aws_exceptions from . import utils from . import exceptions -# Stub ConnectionError && ConnectionResetError for Python 2.7 +# Stub Python3 exceptions for Python 2.7 try: ConnectionError except NameError: @@ -20,6 +22,9 @@ except NameError: class ConnectionResetError(Exception): pass + class TimeoutError(Exception): + pass + LOGGER = logging.getLogger(__name__) @@ -121,6 +126,8 @@ class DynamoDB(object): response_reason = http_err.response.body future.set_exception( exceptions.RequestException(response_reason)) + except TimeoutError: + future.set_exception(exceptions.TimeoutException()) except Exception as exception: future.set_exception(exception) else: @@ -140,6 +147,8 @@ class DynamoDB(object): except (ConnectionError, ConnectionResetError, OSError, + select.error, + ssl.socket_error, socket.gaierror) as error: future.set_exception(exceptions.RequestException(str(error))) except httpclient.HTTPError as err: