runSafely

inline fun runSafely(onError: (Throwable) -> Unit = {}, block: () -> Unit)

Runs block, routing any thrown Throwable to onError instead of letting it propagate — the standard try/catch idiom every built-in EventRunner's real work is wrapped in, so a runner's own failure always turns into that event's own onFailure trigger rather than crashing the caller.

Parameters

onError

called with the thrown value, if block throws. Defaults to swallowing silently.

block

the work to run, at most once.