Rename AuthorizationError to ValidationError, rename suberrors
All checks were successful
Build and test / build (push) Successful in 2m55s
Build and test / check (push) Successful in 3m4s
Build and test / test (push) Successful in 4m33s
Build and test / check-license (push) Successful in 5m35s
Build and test / docs (push) Successful in 8m23s

This commit is contained in:
2025-12-15 14:54:51 +09:00
parent 5f03b55eb5
commit 3f014f073e
17 changed files with 135 additions and 135 deletions

View File

@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
use thiserror::Error;
use crate::core::{
protocol::request_validation::AuthorizationError,
protocol::request_validation::ValidationError,
types::{DbOrUser, MySQLUser},
};
@@ -12,8 +12,8 @@ pub type SetUserPasswordResponse = Result<(), SetPasswordError>;
#[derive(Error, Debug, Clone, PartialEq, Serialize, Deserialize)]
pub enum SetPasswordError {
#[error("Authorization error: {0}")]
AuthorizationError(#[from] AuthorizationError),
#[error("Validation error: {0}")]
ValidationError(#[from] ValidationError),
#[error("User does not exist")]
UserDoesNotExist,
@@ -37,7 +37,7 @@ pub fn print_set_password_output_status(output: &SetUserPasswordResponse, userna
impl SetPasswordError {
pub fn to_error_message(&self, username: &MySQLUser) -> String {
match self {
SetPasswordError::AuthorizationError(err) => {
SetPasswordError::ValidationError(err) => {
err.to_error_message(DbOrUser::User(username.clone()))
}
SetPasswordError::UserDoesNotExist => {
@@ -52,7 +52,7 @@ impl SetPasswordError {
#[allow(dead_code)]
pub fn error_type(&self) -> String {
match self {
SetPasswordError::AuthorizationError(err) => err.error_type(),
SetPasswordError::ValidationError(err) => err.error_type(),
SetPasswordError::UserDoesNotExist => "user-does-not-exist".to_string(),
SetPasswordError::MySqlError(_) => "mysql-error".to_string(),
}