#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[non_exhaustive]
pub enum ConfroidError {
#[error("environment variable `{var_name}` (field `{field}`) is not set")]
EnvVarNotFound {
var_name: String,
field: String,
},
#[error(
"environment variable `{var_name}` (field `{field}`) has invalid value `{value}`: {parser_error}"
)]
EnvVarInvalid {
var_name: String,
field: String,
value: String,
parser_error: String,
},
#[error(
"vector `{field}` (var `{var_name}`) is missing index {missing}; indices must be contiguous starting at 0"
)]
VecIndexGap {
var_name: String,
field: String,
missing: usize,
},
}
pub type Result<T> = core::result::Result<T, ConfroidError>;