Skip to content

Commit

Permalink
Merge branch 'dynamodb-propogate' into develop
Browse files Browse the repository at this point in the history
Fixes boto#1226 and boto#1194.

* dynamodb-propogate:
  Raise specific error when throughput is exceeded
  Remove debug comments
  • Loading branch information
jamesls committed Jan 10, 2013
2 parents 31a575c + 7ff11e4 commit 5b5d688
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
10 changes: 10 additions & 0 deletions boto/dynamodb/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,13 @@ class DynamoDBValidationError(DynamoDBResponseError):
has exceeded the 64Kb size limit.
"""
pass


class DynamoDBThroughputExceededError(DynamoDBResponseError):
"""
Raised when the provisioned throughput has been exceeded.
Normally, when provisioned throughput is exceeded the operation
is retried. If the retries are exhausted then this exception
will be raised.
"""
pass
13 changes: 6 additions & 7 deletions boto/dynamodb/layer1.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
from boto.dynamodb import exceptions as dynamodb_exceptions
from boto.compat import json

#
# To get full debug output, uncomment the following line and set the
# value of Debug to be 2
#
#boto.set_stream_logger('dynamodb')
Debug = 0


class Layer1(AWSAuthConnection):
"""
Expand Down Expand Up @@ -144,6 +137,12 @@ def _retry_handler(self, response, i, next_sleep):
next_sleep = self._exponential_time(i)
i += 1
status = (msg, i, next_sleep)
if i == self.NumberRetries:
# If this was our last retry attempt, raise
# a specific error saying that the throughput
# was exceeded.
raise dynamodb_exceptions.DynamoDBThroughputExceededError(
response.status, response.reason, data)
elif self.SessionExpiredError in data.get('__type'):
msg = 'Renewing Session Token'
self._get_session_token()
Expand Down

0 comments on commit 5b5d688

Please sign in to comment.