Skip to content

Conversation

@ikonst
Copy link
Contributor

@ikonst ikonst commented Jan 11, 2023

This will allow the caller to know e.g. which of the transaction items ran into a conflict, which can sometimes allow app logic to better handle the error without needing to make more requests.

A transaction cancellation response has the following shape:

{
  "__type": "com.amazonaws.dynamodb.v20120810#TransactionCanceledException",
  "CancellationReasons": [
    {
      "Code": "None"
    },
    {
      "Code": "ConditionalCheckFailed",
      "Message": "The conditional request failed"
    }
  ],
  "Message": "Transaction cancelled, please refer cancellation reasons for specific reasons [None, ConditionalCheckFailed]"
}

where the first item was not a reason for cancellation and the second one was.

Curiously, this field is not parsed by botocore: only some of the AWS SDKs (Java, Ruby...) parse it.

@ikonst ikonst force-pushed the 2023-01-11-cancellation_reasons branch from 44bcdeb to 3ea14f7 Compare January 11, 2023 21:34
@ikonst ikonst force-pushed the 2023-01-11-cancellation_reasons branch from 8aabf45 to 4091a65 Compare January 12, 2023 03:01
@ikonst ikonst linked an issue Jan 12, 2023 that may be closed by this pull request
@ikonst ikonst merged commit b03838c into master Jan 15, 2023
@ikonst ikonst deleted the 2023-01-11-cancellation_reasons branch January 15, 2023 00:09
ikonst added a commit that referenced this pull request Jan 26, 2023
This will allow the caller to know e.g. which of the transaction items ran into a conflict, which can sometimes allow app logic to better handle the error without needing to make more requests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose CancellationReasons for TransactionCanceledException

3 participants