client: add error subtypes for name and owner validation in json output

This commit is contained in:
2025-12-04 12:18:50 +09:00
parent f5d3c46e60
commit 1e7911023e
16 changed files with 156 additions and 75 deletions

View File

@@ -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)]