lc_providers/providers/azure/
error.rs1#[derive(Debug)]
6#[non_exhaustive]
7pub enum AzureOpenAIError {
8 Http(String),
10 Api(String),
12 Parse(String),
14 StreamInterrupted(String),
18}
19
20impl std::fmt::Display for AzureOpenAIError {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 AzureOpenAIError::Http(msg) => write!(f, "Azure OpenAI HTTP error: {}", msg),
24 AzureOpenAIError::Api(msg) => write!(f, "Azure OpenAI API error: {}", msg),
25 AzureOpenAIError::Parse(msg) => write!(f, "Azure OpenAI parse error: {}", msg),
26 AzureOpenAIError::StreamInterrupted(msg) => write!(
27 f,
28 "Azure OpenAI stream interrupted before terminal event (output truncated): {}",
29 msg
30 ),
31 }
32 }
33}
34
35impl std::error::Error for AzureOpenAIError {}
36
37impl From<String> for AzureOpenAIError {
38 fn from(s: String) -> Self {
39 AzureOpenAIError::Api(s)
40 }
41}