aither_codex/error.rs
1//! Error type for the Codex provider.
2
3/// Errors from Codex OAuth flows and API calls.
4#[derive(Debug, thiserror::Error)]
5pub enum CodexError {
6 /// HTTP transport or status error.
7 #[error("HTTP request failed: {0}")]
8 Http(#[from] zenwave::Error),
9 /// JSON serialization/deserialization error.
10 #[error("JSON error: {0}")]
11 Json(#[from] serde_json::Error),
12 /// Error body returned by an endpoint (`detail` field).
13 #[error("Codex API error: {0}")]
14 Api(String),
15 /// The user has not completed device authorization yet.
16 #[error("device authorization is still pending")]
17 AuthorizationPending,
18 /// The OAuth loopback listener failed or the callback did not arrive.
19 #[error("OAuth callback error: {0}")]
20 Callback(String),
21 /// The callback `state` did not match the issued one.
22 #[error("OAuth state mismatch")]
23 StateMismatch,
24 /// I/O error (e.g. binding the loopback listener).
25 #[error("I/O error: {0}")]
26 Io(#[from] std::io::Error),
27 /// Error from the underlying `OpenAI` client.
28 #[error("OpenAI error: {0}")]
29 OpenAI(#[from] aither_openai::OpenAIError),
30}