Skip to content

Commit

Permalink
Merge branch 'hotfix/0.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdah committed Jun 28, 2014
2 parents 1e0aadf + 6e28d20 commit f30dc96
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
5 changes: 5 additions & 0 deletions docs/release_notes.rst
@@ -1,6 +1,11 @@
Release notes
=============

0.2.2 (2014-06-28)
------------------

* Address common DynamoDB exceptions (`#17 <https://github.com/sebdah/dynamodb-config-store/issues/17>`_)

0.2.1 (2014-06-28)
------------------

Expand Down
21 changes: 20 additions & 1 deletion dynamodb_config_store/__init__.py
Expand Up @@ -35,6 +35,12 @@
import time
from ConfigParser import SafeConfigParser

from boto.dynamodb2.exceptions import (
LimitExceededException,
ProvisionedThroughputExceededException,
ResourceInUseException,
ResourceNotFoundException,
ValidationException)
from boto.dynamodb2.fields import HashKey, RangeKey
from boto.dynamodb2.table import Table
from boto.exception import JSONResponseError
Expand Down Expand Up @@ -236,4 +242,17 @@ def set(self, option, data):
data[self.store_key] = self.store_name
data[self.option_key] = option

return self.table.put_item(data, overwrite=True)
try:
return self.table.put_item(data, overwrite=True)
except LimitExceededException:
raise
except ProvisionedThroughputExceededException:
raise
except ResourceInUseException:
raise
except ResourceNotFoundException:
raise
except ValidationException:
raise
except Exception:
raise
2 changes: 1 addition & 1 deletion dynamodb_config_store/settings.conf
@@ -1,2 +1,2 @@
[general]
version: 0.2.1
version: 0.2.2
10 changes: 9 additions & 1 deletion test.py
@@ -1,9 +1,10 @@
""" Unit tests for DynamoDB Config Store """
import time
import unittest
from random import random

from boto.dynamodb2.layer1 import DynamoDBConnection
from boto.dynamodb2.exceptions import ItemNotFound
from boto.dynamodb2.exceptions import ItemNotFound, ValidationException
from boto.dynamodb2.table import Table

from dynamodb_config_store import DynamoDBConfigStore
Expand Down Expand Up @@ -413,6 +414,13 @@ def test_update_with_new_keys(self):
self.assertNotIn('username', option)
self.assertNotIn('password', option)

def test_instert_too_large_object(self):
""" Test of inserting an object larger than 64 kb """
with self.assertRaises(ValidationException):
self.store.set(
'large',
{x: int(random()*100000000000000) for x in xrange(1, 9999)})

def tearDown(self):
""" Tear down the test case """
self.table.delete()
Expand Down

0 comments on commit f30dc96

Please sign in to comment.