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

@@ -79,13 +79,15 @@ impl LockUserError {
}
}
pub fn error_type(&self) -> &'static str {
pub fn error_type(&self) -> String {
match self {
LockUserError::SanitizationError(_) => "sanitization-error",
LockUserError::OwnershipError(_) => "ownership-error",
LockUserError::UserDoesNotExist => "user-does-not-exist",
LockUserError::UserIsAlreadyLocked => "user-is-already-locked",
LockUserError::MySqlError(_) => "mysql-error",
LockUserError::SanitizationError(err) => {
format!("sanitization-error/{}", err.error_type())
}
LockUserError::OwnershipError(err) => format!("ownership-error/{}", err.error_type()),
LockUserError::UserDoesNotExist => "user-does-not-exist".to_string(),
LockUserError::UserIsAlreadyLocked => "user-is-already-locked".to_string(),
LockUserError::MySqlError(_) => "mysql-error".to_string(),
}
}
}