How can I print stack trace that collected by anyhow or thiserror? #713
-
I would like to make my app that prints error to stdout with tracing when handler returned Result::Err. but seems like returning Result type from handler just turns into response with How can I make it prints stack trace or prints struct with debug when handler returned Result::Err? or, is there anything best practice to use anyhow and thiserror with axum (I would like to hear that not uses those crates if exists!)? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
You have to make a newtype wrapper for |
Beta Was this translation helpful? Give feedback.
-
Thanks, this is really helpful. I wonder if an example like this should be included in the docs at |
Beta Was this translation helpful? Give feedback.
You have to make a newtype wrapper for
anyhow::Error
and implementIntoResponse
for it an print the stack trace in that implementation.