use std::path::PathBuf;
use thiserror::Error;
pub type ProfileResult<T> = Result<T, ProfileError>;
#[derive(Debug, Error)]
pub enum ProfileError {
#[error("Failed to read profile {path}: {source}")]
ReadFile {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("Failed to parse profile {path}: {source}")]
ParseYaml {
path: PathBuf,
#[source]
source: serde_yaml::Error,
},
#[error("Failed to serialize profile: {0}")]
SerializeYaml(#[source] serde_yaml::Error),
#[error("Invalid profile path: {path}")]
InvalidProfilePath { path: PathBuf },
#[error(
"Profile {path} still carries a top-level `{key}:` section. The provider catalog and \
gateway routes are implementation configuration and now live in the services tree: \
move the `{key}:` block into `{destination}` (relative to `paths.services`), list that \
file in the root `includes:` of services/config/config.yaml, and delete it from the \
profile."
)]
MovedToServices {
path: PathBuf,
key: String,
destination: String,
},
#[error("Profile '{name}' validation failed:\n - {}", errors.join("\n - "))]
Validation { name: String, errors: Vec<String> },
#[error("Missing required environment variable: {name}")]
MissingEnvVar { name: &'static str },
#[error("Invalid environment variable {name}: {message}")]
InvalidEnvVar { name: &'static str, message: String },
}