catch

inline fun <Ok : Any> catch(block: RaiseScope<Throwable>.() -> Ok): Outcome<Ok, Throwable>

An alias for outcomeOf that uses Throwable as the Error type.

Useful for cases where you want to catch & wrap all exceptions to handle them as Failure.

Return

An Outcome instance containing the result of the block execution.

Parameters

Ok

The output type of the block, which must be a subtype of Any.

block

The block that provides the value for the success outcome.

See also


inline fun <In, Out : Any> In.catch(block: RaiseScope<Throwable>.(In) -> Out): Outcome<Out, Throwable>

An alias for outcomeOf that uses Throwable as the Error type.

Useful for cases where you want to catch & wrap all exceptions to handle them as Failure.

Receiver

Some input type, In, passed to block.

Return

An Outcome instance containing the result of the block execution.

Parameters

Out

The output type of the block, which must be a subtype of Any.

block

The block that provides the value for the success outcome.

See also