codex-convert-proxy 0.1.4

A high-performance proxy server that converts between different AI API formats
Documentation
//! Error types for the library.

use thiserror::Error;

/// Error types for conversion operations.
#[derive(Error, Debug)]
pub enum ConversionError {
    #[error("Missing required field: {0}")]
    MissingField(String),

    #[error("Invalid input format: {0}")]
    InvalidFormat(String),

    #[error("Provider error: {0}")]
    ProviderError(String),

    #[error("JSON error: {0}")]
    JsonError(#[from] serde_json::Error),

    /// tool_search_output's call_id does not match any registered tool_search_call.
    #[error(
        "tool_search call_id mismatch: expected '{expected}', got '{actual}'. \
        The tool_search_output may be missing its corresponding tool_search_call."
    )]
    ToolSearchCallIdMismatch {
        expected: String,
        actual: String,
    },
}

/// Error types for proxy operations.
#[derive(Error, Debug)]
pub enum ProxyError {
    #[error("Connection error: {0}")]
    ConnectionError(String),

    #[error("Upstream error: {0}")]
    UpstreamError(String),

    #[error("Request error: {0}")]
    RequestError(String),

    #[error("Response error: {0}")]
    ResponseError(String),

    #[error("Conversion error: {0}")]
    ConversionError(#[from] ConversionError),
}