#[derive(thiserror::Error, Debug)]
pub enum LangfuseError {
#[error("Configuration error: {0}")]
Config(#[from] ConfigError),
#[error("API error: {status} - {message}")]
Api {
status: u16,
message: String,
},
#[error("Authentication failed")]
Auth,
#[error("Network error: {0}")]
Network(#[from] reqwest::Error),
#[error("Serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("Prompt not found: {name}")]
PromptNotFound {
name: String,
},
#[error("Prompt compilation error: missing variable '{variable}'")]
PromptCompilation {
variable: String,
},
#[error("Media error: {0}")]
Media(String),
#[error("OpenTelemetry error: {0}")]
Otel(String),
}
#[derive(thiserror::Error, Debug)]
pub enum ConfigError {
#[error("Missing required configuration: {field}")]
MissingField {
field: String,
},
#[error("Invalid configuration value for '{field}': {message}")]
InvalidValue {
field: String,
message: String,
},
}
pub type Result<T> = std::result::Result<T, LangfuseError>;