return accurate http status codes for dashboard client errors

This commit is contained in:
damocles 2026-06-22 13:57:27 +02:00 committed by mara
commit 5dc1b3933a
7 changed files with 63 additions and 22 deletions

View file

@ -13,7 +13,7 @@ use axum::{
};
use serde::Deserialize;
use super::{AppState, error_response};
use super::{AppState, error_response, problem_response};
/// `POST /api/topology/set-parent` body. `child` is required.
/// `new_parent` may be:
@ -53,7 +53,7 @@ pub(super) async fn post_set_parent(
) -> Response {
let child = form.child.trim().to_owned();
if child.is_empty() {
return error_response("set-parent: `child` required");
return problem_response(StatusCode::BAD_REQUEST, "set-parent: `child` required");
}
// Empty / whitespace-only `new_parent` ⇒ promote to root. Web
// forms submit the empty string for a "no value" radio button,