ai.events.guard

Wrap a listener so a listener error can never fail or alter a run. A null listener stays null; callers `if let` and skip emission entirely. `E` accepts fallible listeners (host callables included); the wrapper swallows whatever they throw, hence the `throws never` on the returned type.

Reference version

Signature

function ai.events.guard<E>(
listener: ((ai.events.Event) -> void throws E) | null
) -> ((ai.events.Event) -> void throws never) | null

Wrap a listener so a listener error can never fail or alter a run. A null listener stays null; callers if let and skip emission entirely. E accepts fallible listeners (host callables included); the wrapper swallows whatever they throw, hence the throws never on the returned type.

Source:<builtin>/ai/ns_events/events.bamlbytes 49025195