EngineError
Defined in: packages/engine/src/errors/EngineError.ts:97
The engine’s structured error type. Still a real Error subclass (so
throw/catch/instanceof Error all keep working exactly as before),
but now every field except the removed severity/recovery pair is
something real code reads.
Extends
Section titled “Extends”Error
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new EngineError(category, init): EngineError;Defined in: packages/engine/src/errors/EngineError.ts:119
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
category | ErrorCategory |
init | EngineErrorInit |
Returns
Section titled “Returns”EngineError
Overrides
Section titled “Overrides”Error.constructorProperties
Section titled “Properties”category
Section titled “category”readonly category: ErrorCategory;Defined in: packages/engine/src/errors/EngineError.ts:98
cause?
Section titled “cause?”readonly optional cause?: unknown;Defined in: packages/engine/src/errors/EngineError.ts:117
Set explicitly (not via super(message, {cause})). This repo’s
tsconfig.json targets ES6/ES5-ES7 lib, which predates TypeScript’s
ES2022 Error constructor cause-option overload. Error.prototype.cause
is still a real runtime feature in every target this engine actually
runs in (Node 16.9+, all evergreen browsers, Electron/Obsidian’s
bundled Chromium) regardless of the TS lib target used to type-check
against it, assigning it directly gets the same Node-printer/logger
interop with no build-config change needed.
readonly code: string;Defined in: packages/engine/src/errors/EngineError.ts:99
context?
Section titled “context?”readonly optional context?: Record<string, unknown>;Defined in: packages/engine/src/errors/EngineError.ts:105
expected?
Section titled “expected?”readonly optional expected?: string;Defined in: packages/engine/src/errors/EngineError.ts:100
found?
Section titled “found?”readonly optional found?: string;Defined in: packages/engine/src/errors/EngineError.ts:101
message
Section titled “message”message: string;Defined in: docs/node_modules/typescript/lib/lib.es5.d.ts:1075
Inherited from
Section titled “Inherited from”Error.messagename: string;Defined in: docs/node_modules/typescript/lib/lib.es5.d.ts:1074
Inherited from
Section titled “Inherited from”Error.namerecoverable
Section titled “recoverable”readonly recoverable: boolean;Defined in: packages/engine/src/errors/EngineError.ts:103
readonly optional span?: SourceSpan;Defined in: packages/engine/src/errors/EngineError.ts:104
stack?
Section titled “stack?”optional stack?: string;Defined in: docs/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Section titled “Inherited from”Error.stacksuggestion?
Section titled “suggestion?”readonly optional suggestion?: string;Defined in: packages/engine/src/errors/EngineError.ts:102
timestamp
Section titled “timestamp”readonly timestamp: Date;Defined in: packages/engine/src/errors/EngineError.ts:106
stackTraceLimit
Section titled “stackTraceLimit”static stackTraceLimit: number;Defined in: node_modules/@types/node/globals.d.ts:67
The Error.stackTraceLimit property specifies the number of stack frames
collected by a stack trace (whether generated by new Error().stack or
Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes
will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Section titled “Inherited from”Error.stackTraceLimitMethods
Section titled “Methods”causeChain()
Section titled “causeChain()”causeChain(): unknown[];Defined in: packages/engine/src/errors/EngineError.ts:143
Walk .cause repeatedly, collecting the full chain (this error first).
Returns
Section titled “Returns”unknown[]
format()
Section titled “format()”format(): string;Defined in: packages/engine/src/errors/EngineError.ts:165
Rust/Go-style multi-line renderer, the NEW thing a host/CLI/test
reaches for when it wants the full, verbose picture, as distinct from
.message (kept short and stable for existing assertions). Example:
error[WEATHER_EXPECTED_CITY]: Expected a city name after "weather in" expected: a city name found: end of expression suggestion: e.g. "weather in London"Returns
Section titled “Returns”string
isFatal()
Section titled “isFatal()”isFatal(): boolean;Defined in: packages/engine/src/errors/EngineError.ts:138
!recoverable. See EngineErrorInit.recoverable’s doc comment for what this actually gates (message framing/telemetry, not whether evaluation continues).
Returns
Section titled “Returns”boolean
toJSON()
Section titled “toJSON()”toJSON(): Record<string, unknown>;Defined in: packages/engine/src/errors/EngineError.ts:173
Returns
Section titled “Returns”Record<string, unknown>
captureStackTrace()
Section titled “captureStackTrace()”static captureStackTrace(targetObject, constructorOpt?): void;Defined in: node_modules/@types/node/globals.d.ts:51
Creates a .stack property on targetObject, which when accessed returns
a string representing the location in the code at which
Error.captureStackTrace() was called.
const myObject = {};Error.captureStackTrace(myObject);myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with
${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames
above constructorOpt, including constructorOpt, will be omitted from the
generated stack trace.
The constructorOpt argument is useful for hiding implementation
details of error generation from the user. For instance:
function a() { b();}
function b() { c();}
function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error;}
a();Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Error.captureStackTraceprepareStackTrace()
Section titled “prepareStackTrace()”static prepareStackTrace(err, stackTraces): any;Defined in: node_modules/@types/node/globals.d.ts:55
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
Section titled “Returns”any
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Section titled “Inherited from”Error.prepareStackTrace