Skip to content
English

ErrorContext ​

CORE · interface · 类型合同

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

导入 ​

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

其他公开入口:@jangts/agent-core/types、@jangts/agent-core/structs、@jangts/agent-core/errors。

定义 ​

ts
interface ErrorContext

字段结构 ​

字段类型必需说明
stageIdstring | undefined可省略只读。Stage that first observed the error; later annotations keep the earliest value.
codesreadonly string[] | undefined可省略只读。Codes contributed by the boundary, merged with those found on the error itself.
isRetryableboolean | undefined可省略只读。Retryability asserted by the boundary; omitted when it cannot be determined.

类型使用 ​

在调用方读取该合同 ​

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

// 在使用点保留原合同,TS 与 JS 具有相同的运行行为。
function inspect(value: ErrorContext) {
  return value.stageId;
}
js
/** @param {import('@jangts/agent-core/errors').ErrorContext} value */
function inspect(value) {
  return value.stageId;
}

接口参考、使用示例与开发指南。