Skip to content
中文

ErrorContext ​

CORE · interface · Type contract

Boundary metadata is recorded internally, without replacing the original thrown value.

Import ​

ts
import type { ErrorContext } from '@jangts/agent-core/errors';
js
/** @typedef {import('@jangts/agent-core/errors').ErrorContext} ErrorContext */

Other public entry points:@jangts/agent-core/types, @jangts/agent-core/structs, @jangts/agent-core/errors.

Definition ​

ts
interface ErrorContext

Field structure ​

FieldTypeRequiredDescription
stageIdstring | undefinedOptionalRead-only. Stage that first observed the error; later annotations keep the earliest value.
codesreadonly string[] | undefinedOptionalRead-only. Codes contributed by the boundary, merged with those found on the error itself.
isRetryableboolean | undefinedOptionalRead-only. Retryability asserted by the boundary; omitted when it cannot be determined.

Using the type ​

Read the contract at the call site ​

ts
import type { ErrorContext } from '@jangts/agent-core/errors';

// Keep the original contract at the call site; TS and JS share the same runtime behavior.
function inspect(value: ErrorContext) {
  return value.stageId;
}
js
/** @param {import('@jangts/agent-core/errors').ErrorContext} value */
function inspect(value) {
  return value.stageId;
}

API reference, usage examples and developer guides.