boto/boto — Issue #580: Add custom exception for Layer1.put_item() with expected_value
Author: gtaylor
Created: 2012-02-14 05:10:44+00:00
State: open
Labels: Feature, SES

Currently, boto.dynamodb.layer1.Layer1.put_item raises a generic ``DynamoDBResponseError`` when a value that isn't expected is found. We'll definitely want a custom exception for this, since DynamoDBResponseError can mean all sorts of things right now. Perhaps ``DynamoDBUnexpectedValueFoundError`` or something?

```
>>> item.put(expected_value={'yay': False})
Traceback (most recent call last):
File "", line 1, in
File "boto/dynamodb/item.py", line 173, in put
return self.table.layer2.put_item(self, expected_value, return_values)
File "boto/dynamodb/layer2.py", line 517, in put_item
object_hook=item_object_hook)
File "boto/dynamodb/layer1.py", line 334, in put_item
object_hook=object_hook)
File "boto/dynamodb/layer1.py", line 121, in make_request
retry_handler=self._retry_handler)
File "boto/connection.py", line 746, in _mexe
status = retry_handler(response, i, next_sleep)
File "boto/dynamodb/layer1.py", line 148, in _retry_handler
json_response)
boto.exception.DynamoDBResponseError: DynamoDBResponseError: 400 Bad Request
{'message': 'The conditional request failed', '__type': 'com.amazonaws.dynamodb.v20111205#ConditionalCheckFailedException'}
```