Moved to better error handling system

This commit is contained in:
2025-02-07 09:03:51 +01:00
parent 35527cbeb7
commit f7b7ebbb1c
4 changed files with 64 additions and 35 deletions

View File

@@ -1,6 +1,9 @@
use std::collections::HashMap;
use axum::{extract::State, Json};
use axum::{
extract::{FromRef, State},
Json,
};
use itertools::Itertools;
use sqlx::PgPool;
@@ -53,10 +56,13 @@ pub async fn migrate_confirm<'a>(
tracing::info!("Migration is confirmed");
// TODO: Implement better error naming
let count = match body.trim().parse::<u32>() {
Ok(c) => c,
Err(_) => return Err(crate::Error::NotFound),
Err(_) => {
return Err(crate::Error::BadRequest {
expected: String::from("u32"),
})
}
};
let mut store = state.migration_store.lock().await;