Class TransactionFailedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.hogwai.dynamodb.simplified.exception.DynamoSimplifiedException
dev.hogwai.dynamodb.simplified.exception.TransactionFailedException
- All Implemented Interfaces:
Serializable
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 Summary
ConstructorsConstructorDescriptionTransactionFailedException(@NonNull software.amazon.awssdk.services.dynamodb.model.TransactionCanceledException cause) Creates a TransactionFailedException from an SDK TransactionCanceledException. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringgetCancellationReason(int index) Returns the cancellation reason for the operation at the given index.Returns the list of cancellation reasons, one per operation in the order they were added.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
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
-
getCancellationReason
Returns the cancellation reason for the operation at the given index.- Parameters:
index- the operation index (0-based)- Returns:
- the cancellation reason, or
nullif the operation succeeded - Throws:
IndexOutOfBoundsException- if the index is out of range
-