client: add error type field for --json outputs
Build and test / test (push) Has been cancelled
Build and test / check (push) Has been cancelled
Build and test / docs (push) Has been cancelled
Build and test / build (push) Has been cancelled
Build and test / check-license (push) Has been cancelled

This commit is contained in:
2025-12-03 15:44:18 +09:00
parent 32b70c44c6
commit afbba78e39
12 changed files with 136 additions and 0 deletions
@@ -45,6 +45,7 @@ pub fn print_unlock_users_output_status_json(output: &UnlockUsersResponse) {
name.to_string(),
json!({
"status": "error",
"type": err.error_type(),
"error": err.to_error_message(name),
}),
),
@@ -77,4 +78,14 @@ impl UnlockUserError {
}
}
}
pub fn error_type(&self) -> &'static str {
match self {
UnlockUserError::SanitizationError(_) => "sanitization-error",
UnlockUserError::OwnershipError(_) => "ownership-error",
UnlockUserError::UserDoesNotExist => "user-does-not-exist",
UnlockUserError::UserIsAlreadyUnlocked => "user-is-already-unlocked",
UnlockUserError::MySqlError(_) => "mysql-error",
}
}
}