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

@@ -75,12 +75,14 @@ impl CreateUserError {
}
}
pub fn error_type(&self) -> &'static str {
pub fn error_type(&self) -> String {
match self {
CreateUserError::SanitizationError(_) => "sanitization-error",
CreateUserError::OwnershipError(_) => "ownership-error",
CreateUserError::UserAlreadyExists => "user-already-exists",
CreateUserError::MySqlError(_) => "mysql-error",
CreateUserError::SanitizationError(err) => {
format!("sanitization-error/{}", err.error_type())
}
CreateUserError::OwnershipError(err) => format!("ownership-error/{}", err.error_type()),
CreateUserError::UserAlreadyExists => "user-already-exists".to_string(),
CreateUserError::MySqlError(_) => "mysql-error".to_string(),
}
}
}