Treat not found as app error at API boundry.

This commit is contained in:
2026-09-25 15:49:30 +02:00
parent adf6888cc7
commit c6efb2cd0b
2 changed files with 13 additions and 7 deletions
+9 -3
View File
@@ -36,18 +36,24 @@ pub enum AppError {
impl IntoResponse for AppError {
fn into_response(self) -> Response {
match self {
Self::NotFound => return StatusCode::NOT_FOUND.into_response(),
Self::NotFound => {
return StatusCode::NOT_FOUND.into_response();
}
Self::ScheduledTransactionValidation(error) => {
return (StatusCode::UNPROCESSABLE_ENTITY, error.to_string()).into_response();
}
Self::Database(error) => tracing::error!(%error, "Database query failed"),
Self::Database(error) => {
tracing::error!(%error, "Database query failed");
}
Self::Direction(error) => {
tracing::error!(%error, "Invalid transaction direction")
}
Self::RecurringTransaction(error) => {
tracing::error!(%error, "Invalid recurring transaction data")
}
Self::Transaction(error) => tracing::error!(%error, "Invalid transaction data"),
Self::Transaction(error) => {
tracing::error!(%error, "Invalid transaction data");
}
}
(StatusCode::INTERNAL_SERVER_ERROR, "Internal server error").into_response()