HttpError
Interface统一错误结构
Signature
interface HttpError {
config: RequestConfig
response?: HttpResponse<T> | undefined
code?: string | undefined
isHttpError: true
}Members
| Name | Type | Description |
|---|---|---|
| config | RequestConfig | — |
| responseoptional | HttpResponse<T> | undefined | — |
| codeoptional | string | undefined | 错误代码,例如: - `'ECONNABORTED'`:超时(含 per-attempt 超时与 overallTimeout) - `'ERR_CANCELED'`:用户主动通过 AbortSignal 取消 - `'ERR_NETWORK'`:网络层错误(DNS 失败、连接被拒绝等) - `'ERR_BAD_RESPONSE'`:收到响应但 `validateStatus` 判定为失败 - `'ERR_BUSINESS'`:`isBusinessSuccess` 判定业务失败 |
| isHttpError | true | — |
Source
packages/http/src/core/types.ts:40