Package dev.mintychochip.mint
Class TransactionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
dev.mintychochip.mint.TransactionException
- All Implemented Interfaces:
Serializable
Base unchecked exception for all transaction-related errors.
Thrown by Transaction.commit() when transaction execution fails due to
validation errors, insufficient funds, concurrency conflicts, or persistence failures.
Error Types
TransactionException.ErrorType.INSUFFICIENT_FUNDS- Withdrawal exceeds balanceTransactionException.ErrorType.TRANSACTION_TIMEOUT- Execution exceeded timeoutTransactionException.ErrorType.OPTIMISTIC_LOCK_FAILURE- Concurrent modificationTransactionException.ErrorType.GENERAL_FAILURE- Unclassified failure
Usage Example
try {
TransactionResult result = transaction.commit().join();
} catch (TransactionException e) {
ErrorType type = e.getErrorType();
// Handle error based on type
}
- Since:
- 1.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumException error types.static final classBuilder for constructing TransactionException instances. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder for constructing a TransactionException.Gets the error type of this exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
builder
Creates a new builder for constructing a TransactionException.- Returns:
- a new builder instance
-
getErrorType
Gets the error type of this exception.- Returns:
- the error type
-