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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ErrorBoundary(
logger):ErrorBoundary
Defined in: ErrorBoundary.ts:46
Parameters
Section titled “Parameters”logger
Section titled “logger”Returns
Section titled “Returns”ErrorBoundary
Methods
Section titled “Methods”clearCallbackErrors()
Section titled “clearCallbackErrors()”clearCallbackErrors():
void
Defined in: ErrorBoundary.ts:154
Clear recorded callback failures.
Returns
Section titled “Returns”void
getCallbackErrors()
Section titled “getCallbackErrors()”getCallbackErrors(): readonly
CallbackErrorRecord[]
Defined in: ErrorBoundary.ts:149
Get recorded failures for inspection.
Returns
Section titled “Returns”readonly CallbackErrorRecord[]
reportLifecycleError()
Section titled “reportLifecycleError()”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.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”void
wrapCallback()
Section titled “wrapCallback()”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.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”void
wrapComponent()
Section titled “wrapComponent()”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.
Parameters
Section titled “Parameters”component
Section titled “component”() => void
Returns
Section titled “Returns”void
wrapLifecycleHook()
Section titled “wrapLifecycleHook()”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.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”void
wrapSystem()
Section titled “wrapSystem()”wrapSystem(
system,fn):void
Defined in: ErrorBoundary.ts:51
Wrap a system update call. Attributes a throw to the system, logs it, and rethrows.
Parameters
Section titled “Parameters”system
Section titled “system”() => void
Returns
Section titled “Returns”void