inline problem_details builder at call sites; drop the one-caller wrapper

This commit is contained in:
damocles 2026-06-22 14:31:30 +02:00 committed by mara
commit 2b0c51badf
8 changed files with 79 additions and 78 deletions

View file

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