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 ErrorContextField structure
| Field | Type | Required | Description |
|---|---|---|---|
stageId | string | undefined | Optional | Read-only. Stage that first observed the error; later annotations keep the earliest value. |
codes | readonly string[] | undefined | Optional | Read-only. Codes contributed by the boundary, merged with those found on the error itself. |
isRetryable | boolean | undefined | Optional | Read-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;
}