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:182

Clear recorded callback failures.

void


getCallbackErrors(): readonly CallbackErrorRecord[]

Defined in: ErrorBoundary.ts:177

Get recorded failures for inspection.

readonly CallbackErrorRecord[]


reportLifecycleError(err, info): void

Defined in: ErrorBoundary.ts:137

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:100

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:76

Wrap a component lifecycle or update call. Attributes a throw to the component, logs it, and rethrows. An async update or hook is reported the same way as in wrapSystem.

Component

() => void

void


wrapLifecycleHook(fn, info): void

Defined in: ErrorBoundary.ts:119

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:58

Wrap a system update call. Attributes a throw to the system, logs it, and rethrows. update/fixedUpdate are typed void-returning but an async one compiles against that signature, so a rejected thenable is reported the same way — rethrown from inside its .then rejection handler, which appears as a new unhandled rejection since the original call stack has already returned.

System

() => void

void

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/core.md.