@@ -8,6 +8,7 @@ use ed25519_dalek::{PUBLIC_KEY_LENGTH, Verifier, VerifyingKey};
88use hex:: FromHex ;
99use http:: { HeaderMap , StatusCode } ;
1010use http_body_util:: BodyExt ;
11+ use lambda_http:: tracing:: error;
1112use once_cell:: sync:: Lazy ;
1213use serde_json:: { Value , json} ;
1314use twilight_model:: application:: command:: CommandType ;
@@ -46,7 +47,10 @@ pub async fn pubkey_middleware(request: Request, next: Next) -> Result<Response,
4647 . get ( "x-signature-ed25519" )
4748 . and_then ( |v| v. to_str ( ) . ok ( ) )
4849 {
49- hex_sig. parse ( ) . map_err ( |_| StatusCode :: INTERNAL_SERVER_ERROR ) ?
50+ hex_sig. parse ( ) . map_err ( |e| {
51+ error ! ( "Internal Server Error: {:?}" , e) ;
52+ StatusCode :: INTERNAL_SERVER_ERROR
53+ } ) ?
5054 } else {
5155 return Err ( StatusCode :: BAD_REQUEST ) ;
5256 } ;
@@ -55,7 +59,10 @@ pub async fn pubkey_middleware(request: Request, next: Next) -> Result<Response,
5559 let body = body
5660 . collect ( )
5761 . await
58- . map_err ( |_| StatusCode :: INTERNAL_SERVER_ERROR ) ?
62+ . map_err ( |e| {
63+ error ! ( "Internal Server Error: {:?}" , e) ;
64+ StatusCode :: INTERNAL_SERVER_ERROR
65+ } ) ?
5966 . to_bytes ( ) ;
6067
6168 if PUB_KEY
@@ -158,7 +165,13 @@ async fn register_commands(
158165 }
159166
160167
161- let application_id = app_state. discord_bot . current_user_application ( ) . await . map_err ( |_| StatusCode :: INTERNAL_SERVER_ERROR ) ?. model ( ) . await . map_err ( |_| StatusCode :: INTERNAL_SERVER_ERROR ) ?. id ;
168+ let application_id = app_state. discord_bot . current_user_application ( ) . await . map_err ( |e| {
169+ error ! ( "Internal Server Error: {:?}" , e) ;
170+ StatusCode :: INTERNAL_SERVER_ERROR
171+ } ) ?. model ( ) . await . map_err ( |e| {
172+ error ! ( "Internal Server Error: {:?}" , e) ;
173+ StatusCode :: INTERNAL_SERVER_ERROR
174+ } ) ?. id ;
162175 let resp = app_state. discord_bot . interaction ( application_id)
163176 . set_global_commands (
164177 & [
@@ -198,6 +211,13 @@ async fn register_commands(
198211 #[ allow( deprecated) ]
199212 dm_permission : None ,
200213 } ] ,
201- ) . await . map_err ( |_| StatusCode :: INTERNAL_SERVER_ERROR ) ?. model ( ) . await . map_err ( |_| StatusCode :: INTERNAL_SERVER_ERROR ) ?;
214+ ) . await . map_err ( |e| {
215+ error ! ( "Internal Server Error: {:?}" , e) ;
216+ StatusCode :: INTERNAL_SERVER_ERROR
217+ } ) ?. model ( ) . await . map_err ( |e| {
218+ error ! ( "Internal Server Error: {:?}" , e) ;
219+ StatusCode :: INTERNAL_SERVER_ERROR
220+ } ) ?;
202221 Ok ( Json ( json ! ( resp) ) )
203- }
222+ }
223+
0 commit comments