#[derive(Debug)]
#[non_exhaustive]
pub enum AzureOpenAIError {
Http(String),
Api(String),
Parse(String),
}
impl std::fmt::Display for AzureOpenAIError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
AzureOpenAIError::Http(msg) => write!(f, "Azure OpenAI HTTP error: {}", msg),
AzureOpenAIError::Api(msg) => write!(f, "Azure OpenAI API error: {}", msg),
AzureOpenAIError::Parse(msg) => write!(f, "Azure OpenAI parse error: {}", msg),
}
}
}
impl std::error::Error for AzureOpenAIError {}
impl From<String> for AzureOpenAIError {
fn from(s: String) -> Self {
AzureOpenAIError::Api(s)
}
}