File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ use crate::zulip::commands::{
2121use anyhow:: { Context as _, format_err} ;
2222use axum:: Json ;
2323use axum:: extract:: State ;
24+ use axum:: extract:: rejection:: JsonRejection ;
2425use axum:: response:: IntoResponse ;
2526use rust_team_data:: v1:: { TeamKind , TeamMember } ;
2627use std:: cmp:: Reverse ;
@@ -92,11 +93,18 @@ struct Response {
9293/// Top-level handler for Zulip webhooks.
9394///
9495/// Returns a JSON response or a 400 with an error message.
95- // TODO: log JsonRejection
9696pub async fn webhook (
9797 State ( ctx) : State < Arc < Context > > ,
98- Json ( req) : Json < Request > ,
98+ req : Result < Json < Request > , JsonRejection > ,
9999) -> axum:: response:: Response {
100+ let Json ( req) = match req {
101+ Ok ( req) => req,
102+ Err ( rejection) => {
103+ tracing:: error!( ?rejection) ;
104+ return rejection. into_response ( ) ;
105+ }
106+ } ;
107+
100108 tracing:: info!( ?req) ;
101109 let response = process_zulip_request ( ctx, req) . await ;
102110 tracing:: info!( ?response) ;
You can’t perform that action at this time.
0 commit comments