What happens when DynamoDBMapper.save() fails?

Viewed 2430

I wonder if the DynamoDBMapper.save() is asynchronous and what happens when something goes wrong? Should I surround the save with try / catch to deal with this?

1 Answers

When using the save, load, and delete methods, DynamoDBMapper will throw DynamoDBMappingExceptions to indicate that domain classes are incorrectly annotated or otherwise incompatible with this class. Service exceptions will always be propagated as SdkClientException, and DynamoDB-specific subclasses such as ConditionalCheckFailedException will be used when possible.

Source

So, if anything goes wrong, you'll get an exception. But all those exceptions are inherited from RuntimeException, i.e. you are not required to catch them. But you are not banned of doing that: you can wrap your code in a try-catch and process them as you wish.

Related