From 3b5abd4177bfe8e7c5e9b72ebd49b29936ad513d Mon Sep 17 00:00:00 2001 From: Rogier Reerink Date: Sun, 11 Oct 2026 08:56:45 +0200 Subject: [PATCH] Ordering. --- server/src/routes/errors.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/server/src/routes/errors.rs b/server/src/routes/errors.rs index 2e39427..72d8346 100644 --- a/server/src/routes/errors.rs +++ b/server/src/routes/errors.rs @@ -107,25 +107,25 @@ impl ClientError for RepositoryError { use crate::repository::{ ReferenceRelation as Relation, ReferenceViolationKind as Kind, }; - match (relation, kind) { - (Relation::Account, Kind::Missing) => ( + match (kind, relation) { + (Kind::Missing, Relation::Account) => ( StatusCode::UNPROCESSABLE_ENTITY, "Account cannot be found".into(), ), - (Relation::RecurringTransaction, Kind::StillReferenced) => ( + (Kind::Missing, Relation::User) => { + (StatusCode::NOT_FOUND, "User cannot be found".into()) + } + (Kind::Missing, Relation::UserApp) => { + (StatusCode::NOT_FOUND, "User app cannot be found".into()) + } + (Kind::StillReferenced, Relation::RecurringTransaction) => ( StatusCode::CONFLICT, "Still referenced by one or more recurring transactions".into(), ), - (Relation::Transaction, Kind::StillReferenced) => ( + (Kind::StillReferenced, Relation::Transaction) => ( StatusCode::CONFLICT, "Still referenced by one or more transactions".into(), ), - (Relation::User, Kind::Missing) => { - (StatusCode::NOT_FOUND, "User cannot be found".into()) - } - (Relation::UserApp, Kind::Missing) => { - (StatusCode::NOT_FOUND, "User app cannot be found".into()) - } _ => internal_error(), } }