client: add error subtypes for name and owner validation in json output
This commit is contained in:
@@ -34,6 +34,14 @@ impl NameValidationError {
|
||||
.to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn error_type(&self) -> &'static str {
|
||||
match self {
|
||||
NameValidationError::EmptyString => "empty-string",
|
||||
NameValidationError::InvalidCharacters => "invalid-characters",
|
||||
NameValidationError::TooLong => "too-long",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl OwnerValidationError {
|
||||
@@ -81,6 +89,13 @@ impl OwnerValidationError {
|
||||
.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn error_type(&self) -> &'static str {
|
||||
match self {
|
||||
OwnerValidationError::NoMatch => "no-match",
|
||||
OwnerValidationError::StringEmpty => "string-empty",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)]
|
||||
|
||||
Reference in New Issue
Block a user