JournalOutcome

sealed interface JournalOutcome<out T>

Library-owned result type for all SagaJournal operations.

Using a sealed hierarchy instead of kotlin.Result<T> avoids historical compiler restrictions on kotlin.Result in suspend-interface positions, and keeps the API consistent with SagaResult / StatefulSagaResult patterns in the library.

Usage

when (val outcome = journal.append(entry)) {
is JournalOutcome.Ok -> process(outcome.value)
is JournalOutcome.Err -> handleError(outcome.cause, outcome.context)
}

Inheritors

Types

Link copied to clipboard
data class Err(val cause: Throwable, val context: String? = null) : JournalOutcome<Nothing>

Failed outcome carrying the root cause and an optional diagnostic context string.

Link copied to clipboard
data class Ok<T>(val value: T) : JournalOutcome<T>

Successful outcome carrying value.