systemprompt_models/profile/
error.rs1use std::path::PathBuf;
7use thiserror::Error;
8
9
10pub type ProfileResult<T> = Result<T, ProfileError>;
11
12#[derive(Debug, Error)]
13pub enum ProfileError {
14 #[error("Failed to read profile {path}: {source}")]
15 ReadFile {
16 path: PathBuf,
17 #[source]
18 source: std::io::Error,
19 },
20
21 #[error("Failed to parse profile {path}: {source}")]
22 ParseYaml {
23 path: PathBuf,
24 #[source]
25 source: serde_yaml::Error,
26 },
27
28 #[error("Failed to serialize profile: {0}")]
29 SerializeYaml(#[source] serde_yaml::Error),
30
31 #[error("Invalid profile path: {path}")]
32 InvalidProfilePath { path: PathBuf },
33
34 #[error(
35 "Profile {path} still carries a top-level `{key}:` section. The provider catalog and \
36 gateway routes are implementation configuration and now live in the services tree: \
37 move the `{key}:` block into `{destination}` (relative to `paths.services`), list that \
38 file in the root `includes:` of services/config/config.yaml, and delete it from the \
39 profile."
40 )]
41 MovedToServices {
42 path: PathBuf,
43 key: String,
44 destination: String,
45 },
46
47 #[error("Profile '{name}' validation failed:\n - {}", errors.join("\n - "))]
48 Validation { name: String, errors: Vec<String> },
49
50 #[error("Missing required environment variable: {name}")]
51 MissingEnvVar { name: &'static str },
52
53 #[error("Invalid environment variable {name}: {message}")]
54 InvalidEnvVar { name: &'static str, message: String },
55}