huskies: merge 1032

This commit is contained in:
dave
2026-05-14 14:41:45 +00:00
parent bc99821274
commit 960b4f4d1d
9 changed files with 606 additions and 44 deletions
+20
View File
@@ -52,6 +52,15 @@ pub enum ValidationError {
InvalidUtf8 { field: String },
/// A `depends_on` entry references the same item being created or updated.
SelfReference { field: String },
/// A field's value is not one of the accepted choices.
InvalidValue {
/// Field name.
field: String,
/// The value that was supplied.
actual: String,
/// The complete set of accepted values.
allowed: Vec<String>,
},
}
impl fmt::Display for ValidationError {
@@ -114,6 +123,17 @@ impl fmt::Display for ValidationError {
"field '{field}' contains a self-reference (depends on itself)"
)
}
Self::InvalidValue {
field,
actual,
allowed,
} => {
write!(
f,
"field '{field}' value {actual:?} is not one of the allowed values: {}",
allowed.join(", ")
)
}
}
}
}