attempt
open suspend fun <E, A> attempt(f: suspend EffectScope<E>.() -> A): suspend EffectScope<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 EffectScope
, giving the chance for a later catch to change the shifted value. This is useful to simulate re-throwing of exceptions.