Raise Scope
A scope for raising typed errors without exceptions leaking to callers.
Create a new scope with DefaultRaiseScope, or use a builder like outcomeOf / faultOf. Inside the scope, call raise to short-circuit execution with an Error. The scope's fold / folding captures the raised error and maps it to an output value.
Parameters
The type of error that can be raised within this scope.
See also
Inheritors
Functions
Executes block inside the current RaiseScope, converting any thrown Throwable — including fatal kotlin.Error subclasses — to a raised Error via catch.
Executes block inside the current RaiseScope, converting any thrown Throwable — including fatal kotlin.Error subclasses — to a raised Error via catch.
Suspend variant of fold that propagates CancellationException for structured concurrency.
Type-hint helper — tells the compiler the Error type of this RaiseScope is Nothing. Use when type inference fails and no error can ever be raised.
Evaluates error and delegates to shortCircuit, immediately short-circuiting the RaiseScope execution.
Type-hint helper — tells the compiler the Error type of this RaiseScope. Use when type inference fails and no value is available to infer from.
Type-hint helper — tells the compiler the Error type of this RaiseScope using a concrete type value. Use when type inference fails and a representative value is available.
Throws the given error, immediately short-circuiting the RaiseScope execution.