StateUpdateResult

sealed interface StateUpdateResult<T>

Represents the result of a state update operation.

This sealed interface provides type-safe error handling for state updates, ensuring that all possible outcomes are explicitly handled.

Parameters

T

The type of the state being updated

Inheritors

Types

Link copied to clipboard
data class Success<T>(val newState: T) : StateUpdateResult<T>

Indicates a successful state update.

Link copied to clipboard
data class UpdateFailure<T>(val currentState: T, val exception: Throwable) : StateUpdateResult<T>

Indicates that the state update failed due to an exception during processing.

Link copied to clipboard
data class ValidationFailure<T>(val currentState: T, val validationResult: ValidationResult) : StateUpdateResult<T>

Indicates that the state update failed due to validation errors.