attempt
open suspend fun <E, A> attempt(f: suspend EagerEffectScope<E>.() -> A): suspend EagerEffectScope<E>.() -> A(source)
Encloses an action for which you want to catch any shift
. attempt is used in combination with catch.
attempt { ... } catch { ... }
Content copied to clipboard
The f may shift
into a different EagerEffectScope
, giving the chance for a later catch to change the shifted value. This is useful to simulate re-throwing of exceptions.