use thiserror::Error;
pub type Result<T> = std::result::Result<T, ManifestError>;
#[derive(Debug, Error)]
pub enum ManifestError {
#[error("failed to parse YAML")]
Yaml(#[from] serde_norway::Error),
#[error("invalid name `{name}`: must match `{pattern}`")]
InvalidName {
name: String,
pattern: &'static str,
},
#[error("dependency cycle detected: {0}")]
Cycle(String),
#[error("unknown resource reference: {0}")]
UnknownResource(String),
#[error("unknown property `{property}` on resource `{resource}` of kind `{kind}`")]
UnknownProperty {
resource: String,
property: String,
kind: &'static str,
},
#[error("environment variable `{0}` is not set and no default was provided")]
EnvUnset(String),
#[error("invalid interpolation: {0}")]
InvalidInterpolation(String),
#[error("invalid duration `{0}`: expected a value like `5s`, `200ms`, `2m`")]
InvalidDuration(String),
#[error("missing required field `{field}` on resource `{resource}`")]
MissingField {
resource: String,
field: &'static str,
},
#[error("invalid dashboard port `{port}`: must be in the range 1..=65535")]
InvalidDashboardPort {
port: u16,
},
}