use std::{path::PathBuf, sync::Arc};
use crate::error::ValidationError;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ProviderError {
#[error("i/o error at {path}: {source}")]
Io {
path: PathBuf,
#[source]
source: std::io::Error,
},
#[error("profile-map file at {path} is {observed} bytes, exceeds cap {limit}")]
FileTooLarge {
path: PathBuf,
observed: u64,
limit: u64,
},
#[error("ini parse error at {path}: {source}")]
Ini {
path: PathBuf,
#[source]
source: ini::ParseError,
},
#[error("yaml deserialise error at {path}: {source}")]
Yaml {
path: PathBuf,
#[source]
source: serde_yaml::Error,
},
#[error("profile-map validation error in {path}: {source}")]
Validation {
path: PathBuf,
#[source]
source: validator::ValidationErrors,
},
#[error("profile-map entry `{profile}` rejected: {source}")]
InvalidEntry {
profile: Arc<str>,
#[source]
source: ValidationError,
},
#[error(
"aws-config source_profile chain at `{profile}` exceeded {limit} hops (probable cycle)"
)]
ChainTooLong {
profile: Arc<str>,
limit: usize,
},
#[error("{count} unresolved profile(s) in strict mode (first: `{first}`)")]
StrictUnresolved {
count: usize,
first: Arc<str>,
},
}
pub type Result<T> = std::result::Result<T, ProviderError>;