Skip to content

exceptions in user defined functions

Raphael Pigulla edited this page Apr 23, 2022 · 2 revisions

Exceptions in user-defined functions

Exceptions in callbacks

The MAP, RECOVER and SIDE_EFFECT handlers support a callback which could itself throw. When this happens, that error is immediately thrown, short-circuiting the handler chain. Note that any error thrown from a TAP callback is always suppressed.

⚠️ Keep your callbacks simple and unlikely to fail.

You can configure what should happen with the error thrown by the callback using the onCallbackError option:

THROW

The error thrown by the callback is re-thrown as-is.

THROW_TRIGGER

The error thrown by the callback is ignored and the triggering error is re-thrown instead (so you will get no indication that the callback failed).

THROW_WRAPPED

The error thrown by the callback is wrapped in a SideEffectError, MapError, or RecoverError depending on the action. This is the default.

Exceptions in predicates

Any exception thrown in a predicate function is wrapped inside PredicateError and thrown. This behaviour is not configurable.