@@ -4,7 +4,7 @@ use ohkami::{IntoResponse, Response};
44use reqwest:: header:: ToStrError ;
55use thiserror:: Error ;
66use tokio:: { io, task:: JoinError } ;
7- use tracing:: error;
7+ use tracing:: { error, instrument } ;
88
99#[ derive( Debug , Error ) ]
1010pub enum Error {
@@ -33,39 +33,27 @@ pub enum Error {
3333}
3434
3535impl IntoResponse for Error {
36+ #[ instrument]
3637 fn into_response ( self ) -> Response {
3738 match self {
38- Error :: Io ( e) => {
39- error ! ( error=%e, "I/O error" ) ;
40- Response :: InternalServerError ( ) . with_text ( "Skin not found" )
41- }
42- Error :: Tee ( e) => {
43- error ! ( error=%e, "Tee error" ) ;
44- Response :: InternalServerError ( ) . with_text ( "Fail to render uv" )
45- }
39+ Error :: Io ( _) => Response :: InternalServerError ( ) . with_text ( "Skin not found" ) ,
40+ Error :: Tee ( _) => Response :: InternalServerError ( ) . with_text ( "Fail to render uv" ) ,
4641 Error :: QueryNameNotFound => {
47- error ! ( "Query expected name, but got none" ) ;
4842 Response :: BadRequest ( ) . with_text ( "Query expected name, but got none" )
4943 }
50- Error :: Reqwest ( e) => {
51- error ! ( error=%e, "Reqwest error" ) ;
52- Response :: InternalServerError ( )
53- }
54- Error :: ToStrError ( e) => {
55- error ! ( error=%e, "Reqwest ToStr error" ) ;
56- Response :: InternalServerError ( )
57- }
58- Error :: SaveFailed {
59- path,
60- name,
61- error,
62- } => todo ! ( ) ,
44+ Error :: Reqwest ( _) => Response :: InternalServerError ( ) ,
45+ Error :: ToStrError ( _) => Response :: InternalServerError ( ) ,
6346 Error :: DownloadFailed {
64- name,
65- error,
47+ name : _ ,
48+ error : _ ,
6649 } => todo ! ( ) ,
67- Error :: TaskJoin ( join_error) => todo ! ( ) ,
68- Error :: Json ( error) => todo ! ( ) ,
50+ Error :: TaskJoin ( _join_error) => Response :: InternalServerError ( ) ,
51+ Error :: Json ( _error) => Response :: InternalServerError ( ) ,
52+ Error :: SaveFailed {
53+ path : _,
54+ name : _,
55+ error : _,
56+ } => Response :: InternalServerError ( ) ,
6957 }
7058 }
7159}
0 commit comments