pub enum ValidationError {
InvalidField {
playbook_id: String,
field: String,
value: String,
reason: String,
},
MissingField {
playbook_id: String,
field: String,
},
DuplicateId {
playbook_id: String,
},
TomlParse(Error),
UnknownPlaybook {
playbook_id: String,
},
UnknownParent {
playbook_id: String,
parent_id: String,
},
}Expand description
Errors returned by playbook validation and loading.
Every variant embeds the playbook id, the field path (a
dotted JSON-pointer-style path such as acquisition.retry_budget),
and the bad value as a string. The Display impl formats all
three so the operator-facing message is actionable without any
auxiliary lookup.
Variants§
InvalidField
A field failed semantic validation (out of range, wrong multiplicity, inconsistent state).
Fields
MissingField
A required field is missing from the TOML payload.
Fields
DuplicateId
The same playbook id appears more than once in the input bundle.
TomlParse(Error)
The TOML parser reported a structural error.
UnknownPlaybook
The resolver was asked for a playbook id that is not loaded.
UnknownParent
A reference to a sibling playbook id (e.g. an
extends = "tier1-static" declaration) could not be resolved.
Implementations§
Source§impl ValidationError
impl ValidationError
Sourcepub fn invalid_field(
playbook_id: impl Into<String>,
field: impl Into<String>,
value: impl Display,
reason: impl Into<String>,
) -> Self
pub fn invalid_field( playbook_id: impl Into<String>, field: impl Into<String>, value: impl Display, reason: impl Into<String>, ) -> Self
Convenience constructor for ValidationError::InvalidField
that builds the field path and bad-value string from caller
inputs.
Sourcepub fn missing_field(
playbook_id: impl Into<String>,
field: impl Into<String>,
) -> Self
pub fn missing_field( playbook_id: impl Into<String>, field: impl Into<String>, ) -> Self
Convenience constructor for ValidationError::MissingField.
Sourcepub fn field_path(&self) -> Option<&str>
pub fn field_path(&self) -> Option<&str>
Field path (dotted JSON-pointer-style) when applicable.
Trait Implementations§
Source§impl Debug for ValidationError
impl Debug for ValidationError
Source§impl Display for ValidationError
impl Display for ValidationError
Source§impl Error for ValidationError
impl Error for ValidationError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()