langchain_rust/embedding/
error.rs1use async_openai::error::OpenAIError;
2#[cfg(feature = "mistralai")]
3use mistralai_client::v1::error::{ApiError, ClientError};
4#[cfg(feature = "ollama")]
5use ollama_rs::error::OllamaError;
6use reqwest::{Error as ReqwestError, StatusCode};
7use thiserror::Error;
8
9#[derive(Error, Debug)]
10pub enum EmbedderError {
11 #[error("Network request failed: {0}")]
12 RequestError(#[from] ReqwestError),
13
14 #[error("OpenAI error: {0}")]
15 OpenAIError(#[from] OpenAIError),
16
17 #[error("URL parsing error: {0}")]
18 UrlParseError(#[from] url::ParseError),
19
20 #[error("HTTP error: {status_code} {error_message}")]
21 HttpError {
22 status_code: StatusCode,
23 error_message: String,
24 },
25
26 #[error("FastEmbed error: {0}")]
27 FastEmbedError(String),
28
29 #[cfg(feature = "ollama")]
30 #[error("Ollama error: {0}")]
31 OllamaError(#[from] OllamaError),
32
33 #[cfg(feature = "mistralai")]
34 #[error("MistralAI Client error: {0}")]
35 MistralAIClientError(#[from] ClientError),
36
37 #[cfg(feature = "mistralai")]
38 #[error("MistralAI API error: {0}")]
39 MistralAIApiError(#[from] ApiError),
40}