systemprompt_models/profile/
error.rs1use std::path::PathBuf;
7use thiserror::Error;
8
9use super::{GatewayProfileError, ProviderRegistryError};
10
11pub type ProfileResult<T> = Result<T, ProfileError>;
12
13#[derive(Debug, Error)]
14pub enum ProfileError {
15 #[error("Failed to read profile {path}: {source}")]
16 ReadFile {
17 path: PathBuf,
18 #[source]
19 source: std::io::Error,
20 },
21
22 #[error("Failed to parse profile {path}: {source}")]
23 ParseYaml {
24 path: PathBuf,
25 #[source]
26 source: serde_yaml::Error,
27 },
28
29 #[error("Failed to serialize profile: {0}")]
30 SerializeYaml(#[source] serde_yaml::Error),
31
32 #[error("Invalid profile path: {path}")]
33 InvalidProfilePath { path: PathBuf },
34
35 #[error(transparent)]
36 Gateway(#[from] GatewayProfileError),
37
38 #[error(transparent)]
39 ProviderRegistry(#[from] ProviderRegistryError),
40
41 #[error("Profile '{name}' validation failed:\n - {}", errors.join("\n - "))]
42 Validation { name: String, errors: Vec<String> },
43
44 #[error("Missing required environment variable: {name}")]
45 MissingEnvVar { name: &'static str },
46
47 #[error("Invalid environment variable {name}: {message}")]
48 InvalidEnvVar { name: &'static str, message: String },
49}