Skip to content

@gluonjs/core / packages/reactivity/src / ReactivityErrorContext

Interface: ReactivityErrorContext ​

Properties ​

error ​

readonly error: unknown


phase ​

readonly phase: ReactivityErrorPhase


source? ​

readonly optional source?: unknown

Example ​

Receive the thrown value, lifecycle phase, and optional source associated with an unhandled reactivity failure:

ts
import {
  queueJob,
  setReactivityErrorHandler,
  type ReactivityErrorContext,
  type ReactivityErrorHandler,
  type ReactivityErrorPhase,
} from '@gluonjs/reactivity';

const errors: ReactivityErrorContext[] = [];
const handler: ReactivityErrorHandler = (context) => { errors.push(context); };
const phase: ReactivityErrorPhase = 'scheduler';
const restore = setReactivityErrorHandler(handler);
queueJob(() => { throw new Error('Inventory failed'); });
await Promise.resolve();
console.log(errors[0]?.phase === phase);
restore();

Version-matched documentation. Examples are checked against the public package contracts.