catchExceptionOf

inline suspend fun <Ok> catchExceptionOf(scope: RaiseScope<Exception> = DefaultRaiseScope(), block: suspend RaiseScope<Exception>.() -> Ok): Outcome<Ok, Exception>

Suspend variant of catchException builder.

Runs block and wraps the result as an Outcome, using Exception as the error type. Every thrown Exception is captured and wrapped in a Failure automatically. kotlinx.coroutines.CancellationException is correctly propagated for structured concurrency.

See also