Skip to content

Commit

Permalink
feat: improved message on TransactionCanceledException
Browse files Browse the repository at this point in the history
* Improve handling of TransactionCanceledException by avoid creating new instance of it from scratch

* Fixing build failures, reverting the previous commit because of test failures and unclear resolution. Adopting decoration of the exception to not lose the AWS error message

* Update log
  • Loading branch information
AmitGoenka authored Sep 18, 2023
1 parent d55c7cf commit 2ed36d2
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,10 @@ internal class DynamoDbLogicalDb(
// parse the potentially concurrency related TransactionCancelledExceptions
// https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/model/TransactionCanceledException.html
throw TransactionCanceledException.builder()
.message("Write transaction failed: ${writeSet.describeOperations()}")
.message(
"Write transaction failed: ${writeSet.describeOperations()}.\n" +
" Aws error message: ${e.message}"
)
.cancellationReasons(e.cancellationReasons())
.build()
}
Expand Down

0 comments on commit 2ed36d2

Please sign in to comment.