Skip to content

ErrorBoundary

Defined in: ErrorBoundary.ts:33

Wraps system, component, and developer-callback execution so a throw is attributed to whoever threw, not whoever it reached: the culprit is recorded (readable via Inspector.getErrors().callbackErrors), logged through Logger, and rethrown. Nothing is disabled, unsubscribed, cancelled, or muted — GameLoop.tick() is the one place that decides an error is terminal, stopping the loop when a throw escapes an entire frame.

new ErrorBoundary(logger): ErrorBoundary

Defined in: ErrorBoundary.ts:46

Logger

ErrorBoundary

clearCallbackErrors(): void

Defined in: ErrorBoundary.ts:154

Clear recorded callback failures.

void


getCallbackErrors(): readonly CallbackErrorRecord[]

Defined in: ErrorBoundary.ts:149

Get recorded failures for inspection.

readonly CallbackErrorRecord[]


reportLifecycleError(err, info): void

Defined in: ErrorBoundary.ts:117

Report an already-caught lifecycle error (a beforeEnter hook awaited inside its own try/catch, for instance) without invoking anything.

unknown

CallbackErrorInfo

void


wrapCallback(fn, info): void

Defined in: ErrorBoundary.ts:82

Wrap a developer-supplied callback the engine invokes on its own — a collision handler, an entity/scene/bus event listener, an input listener, a process callback, an audio unlock callback. Catches a synchronous throw and, since these callbacks are typed void-returning but nothing stops a caller from passing an async function anyway, a rejected thenable too. Both are recorded, logged, and rethrown — a rejected thenable is rethrown from inside its .then rejection handler, which surfaces as a new unhandled rejection since nothing can rethrow into the original (already-returned) call stack.

() => void

CallbackErrorInfo

void


wrapComponent(component, fn): void

Defined in: ErrorBoundary.ts:60

Wrap a component lifecycle or update call. Attributes a throw to the component, logs it, and rethrows.

Component

() => void

void


wrapLifecycleHook(fn, info): void

Defined in: ErrorBoundary.ts:101

Wrap a scene-lifecycle hook (onEnter, onExit, onPause, onResume). Reports through Logger and the error snapshot, then rethrows so propagation to the caller is unchanged — a scene half-built by a throwing hook must not look like it mounted cleanly. An async hook’s rejection can only be reported, not rethrown: the call already returned by the time the rejection settles.

() => void

CallbackErrorInfo

void


wrapSystem(system, fn): void

Defined in: ErrorBoundary.ts:51

Wrap a system update call. Attributes a throw to the system, logs it, and rethrows.

System

() => void

void