inline problem_details builder at call sites; drop the one-caller wrapper
This commit is contained in:
parent
cdf1bfe7db
commit
2b0c51badf
8 changed files with 79 additions and 78 deletions
|
|
@ -10,7 +10,9 @@ use axum::{
|
|||
response::{IntoResponse, Response},
|
||||
};
|
||||
|
||||
use super::{AppState, error_response, problem_response};
|
||||
use problem_details::ProblemDetails;
|
||||
|
||||
use super::{AppState, error_response};
|
||||
|
||||
pub(super) async fn api_reminders(State(state): State<AppState>) -> Response {
|
||||
match state.coord.broker.list_pending_reminders() {
|
||||
|
|
@ -24,10 +26,9 @@ pub(super) async fn post_cancel_reminder(
|
|||
AxumPath(id): AxumPath<i64>,
|
||||
) -> Response {
|
||||
match state.coord.broker.cancel_reminder(id) {
|
||||
Ok(0) => problem_response(
|
||||
StatusCode::NOT_FOUND,
|
||||
&format!("reminder {id} not pending (already delivered?)"),
|
||||
),
|
||||
Ok(0) => ProblemDetails::from_status_code(StatusCode::NOT_FOUND)
|
||||
.with_detail(format!("reminder {id} not pending (already delivered?)"))
|
||||
.into_response(),
|
||||
Ok(_) => {
|
||||
tracing::info!(%id, "operator cancelled reminder");
|
||||
state.coord.emit_reminders_snapshot();
|
||||
|
|
@ -47,10 +48,9 @@ pub(super) async fn post_retry_reminder(
|
|||
AxumPath(id): AxumPath<i64>,
|
||||
) -> Response {
|
||||
match state.coord.broker.reset_reminder_failure(id) {
|
||||
Ok(0) => problem_response(
|
||||
StatusCode::NOT_FOUND,
|
||||
&format!("reminder {id} not pending (already delivered?)"),
|
||||
),
|
||||
Ok(0) => ProblemDetails::from_status_code(StatusCode::NOT_FOUND)
|
||||
.with_detail(format!("reminder {id} not pending (already delivered?)"))
|
||||
.into_response(),
|
||||
Ok(_) => {
|
||||
tracing::info!(%id, "operator reset reminder failure for retry");
|
||||
state.coord.emit_reminders_snapshot();
|
||||
|
|
|
|||
Loading…
Reference in a new issue