Skip to content

classifyAgentProxyRetryable

判断 IM 智能体代理失败是否可自动重试。

函数签名

typescript
interface ClassifyAgentProxyRetryableDeps {
  getHttpStatus?: (error: unknown) => number | undefined
}

function classifyAgentProxyRetryable(
  e: unknown,
  deps?: ClassifyAgentProxyRetryableDeps,
): boolean

工作原理

  1. HTTP 400/401/403/404 → 不重试。
  2. 网络类错误(ECONNRESETETIMEDOUT 等)或含超时/503 文案 → 可重试。
  3. API 侧注入 getHttpStatus 以识别 Nest HttpException