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};
#[derive(Deserialize)]
pub(super) struct AnswerForm {
@ -41,10 +43,11 @@ pub(super) async fn post_answer_question(
) -> Response {
let answer = form.answer.trim();
if answer.is_empty() {
return with_cors(problem_response(
StatusCode::BAD_REQUEST,
"answer: required",
));
return with_cors(
ProblemDetails::from_status_code(StatusCode::BAD_REQUEST)
.with_detail("answer: required")
.into_response(),
);
}
let resp = match state
.coord