Class TransactionFailedException

All Implemented Interfaces:
Serializable

public class TransactionFailedException extends DynamoSimplifiedException
Thrown when a transactional write operation is rejected by DynamoDB.

Wraps the SDK's TransactionCanceledException and exposes the individual cancellation reasons for each operation in the transaction in the order they were added to the builder.

Each cancellation reason corresponds to one operation in the transaction. A reason of null means that operation succeeded.

See Also:
  • Constructor Details

    • TransactionFailedException

      public TransactionFailedException(@NonNull software.amazon.awssdk.services.dynamodb.model.TransactionCanceledException cause)
      Creates a TransactionFailedException from an SDK TransactionCanceledException.
      Parameters:
      cause - the SDK exception with cancellation reasons
  • Method Details

    • getCancellationReasons

      public @NonNull List<String> getCancellationReasons()
      Returns the list of cancellation reasons, one per operation in the order they were added. A null entry means that operation succeeded.
      Returns:
      an unmodifiable list of cancellation reason strings
    • getCancellationReason

      public @Nullable String getCancellationReason(int index)
      Returns the cancellation reason for the operation at the given index.
      Parameters:
      index - the operation index (0-based)
      Returns:
      the cancellation reason, or null if the operation succeeded
      Throws:
      IndexOutOfBoundsException - if the index is out of range