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
+4 -4
View File
@@ -102,8 +102,8 @@ async fn delete_scheduled_transaction(
State(pool): State<PgPool>,
Path(id): Path<Uuid>,
) -> Result<StatusCode, AppError> {
Ok(match delete_scheduled_transaction_by_id(&pool, id).await? {
Delete::Deleted => StatusCode::NO_CONTENT,
Delete::NotFound => StatusCode::NOT_FOUND,
})
match delete_scheduled_transaction_by_id(&pool, id).await? {
Delete::Deleted => Ok(StatusCode::NO_CONTENT),
Delete::NotFound => Err(AppError::NotFound),
}
}