use serde::{Deserialize, Serialize};
use thiserror::Error;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ExternalErrorKind {
InvalidRequest,
Unauthorized,
Unavailable,
RateLimited,
ContextLimit,
CreditBudgetExceeded,
Timeout,
Cancelled,
Internal,
}
#[derive(Clone, Debug, Error, Eq, PartialEq, Serialize, Deserialize)]
#[error("{kind:?}: {message}")]
pub struct ExternalError {
pub kind: ExternalErrorKind,
pub message: String,
pub retry_after_ms: Option<u64>,
}