Expand description
V2 标准错误码:定义 13 个规范错误码及其重试/回退语义。
AI-Protocol V2 standard error codes.
This module defines the canonical error code system from the AI-Protocol V2
specification (see ai-protocol/schemas/v2/error-codes.yaml). Each runtime
implements these codes for consistent error handling across providers.
§Error Code Categories
| Prefix | Category | Description |
|---|---|---|
| E1xxx | client | Request-side errors |
| E2xxx | rate | Rate limit and quota errors |
| E3xxx | server | Provider-side errors |
| E4xxx | operational | Lifecycle and state conflicts |
| E9xxx | unknown | Catch-all / unclassified |
§Example
use ai_lib_rust::error_code::StandardErrorCode;
let code = StandardErrorCode::from_error_class("rate_limited");
assert_eq!(code.code(), "E2001");
assert!(code.retryable());
assert_eq!(code.category(), "rate");Enums§
- Standard
Error Code - Standard AI-Protocol V2 error code.