Saga Execution Error
data class SagaExecutionError(val step: TypedValue, val phase: SagaExecutionError.Phase, val exception: Throwable, val timestamp: Long = System.currentTimeMillis())
Error that occurred during saga execution or compensation.
This class captures detailed information about failures during saga execution, including the step identifier, phase (forward or compensation), and the underlying exception. The step is wrapped in TypedValue to preserve enum type information when enum step names are used.
Usage Example
enum class OrderSteps { VALIDATE, PAYMENT, SHIP }
when (result) {
is SagaResult.Aborted -> {
val error = result.error
// Type-safe enum access
when (error.stepAs<OrderSteps>()) {
OrderSteps.PAYMENT -> handlePaymentFailure(error.exception)
else -> log.error("Step '${error.stepName}' failed: ${error.message}")
}
}
}Content copied to clipboard
Constructors
Link copied to clipboard
constructor(step: TypedValue, phase: SagaExecutionError.Phase, exception: Throwable, timestamp: Long = System.currentTimeMillis())