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

@ -16,7 +16,7 @@ use axum::{
use hive_sh4re::Approval;
use serde::Deserialize;
use super::{AppState, error_response};
use super::{AppState, error_response, problem_response};
use crate::actions;
use crate::coordinator::Coordinator;
use crate::lifecycle;
@ -209,7 +209,12 @@ pub(super) async fn get_approval_diff(
.max()
.map(|n| format!("refs/tags/proposal/{n}"))
}
other => return error_response(&format!("unknown diff base {other:?}")),
other => {
return problem_response(
StatusCode::BAD_REQUEST,
&format!("unknown diff base {other:?}"),
);
}
};
let Some(base_ref) = base_ref else {
return plain_text(match base {