huskies: merge 1032
This commit is contained in:
@@ -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(", ")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user