You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most large complex applications have panics despite our best efforts to the contrary. Good visibility into these panics is the first step to fixing them. In terms of panics, good visibility means logging both the request that caused the panic along with the details of the panic. This is currently not possible in Rocket, as the Catcher functionality does not provide PanicInfo.
Ideal Solution
Ideally, A function decorated with #[catch] may take an additional argument: Option<PanicInfo> that will be either Some<PanicInfo> when the catcher is being caused because of a panic, or None when this is not the case.
The user will then be able to log both the panic, and details about the request that caused the panic, leading to greater visibility into the root cause of the panic and allowing the panic to be eliminated.
Why can't this be implemented outside of Rocket?
Good visibility into panics requires logging both request-information and panic information together. This isn't currently possible without support from Rocket.
Are there workarounds usable today?
The current workaround is to log the panic information (using std::panic::set_hook) and the request information (using #[catch]) separately. This isn't ideal because on a busy server these log messages might be quite far apart and hard to link which panic corresponds to which request.
Just realized that Rocket may not have a full PanicInfo but merely a Box<dyn Any + Send>> (from a std::panic::catch_unwind). Even a Box<dyn Any + Send>> that could be downcasted would be very useful.
What's missing?
Most large complex applications have panics despite our best efforts to the contrary. Good visibility into these panics is the first step to fixing them. In terms of panics, good visibility means logging both the request that caused the panic along with the details of the panic. This is currently not possible in Rocket, as the
Catcher
functionality does not providePanicInfo
.Ideal Solution
Ideally, A function decorated with
#[catch]
may take an additional argument:Option<PanicInfo>
that will be eitherSome<PanicInfo>
when the catcher is being caused because of a panic, orNone
when this is not the case.The user will then be able to log both the panic, and details about the request that caused the panic, leading to greater visibility into the root cause of the panic and allowing the panic to be eliminated.
Why can't this be implemented outside of Rocket?
Good visibility into panics requires logging both request-information and panic information together. This isn't currently possible without support from Rocket.
Are there workarounds usable today?
The current workaround is to log the panic information (using
std::panic::set_hook
) and the request information (using#[catch]
) separately. This isn't ideal because on a busy server these log messages might be quite far apart and hard to link which panic corresponds to which request.Alternative Solutions
No response
Additional Context
There is a stack-overflow related to this here: https://stackoverflow.com/questions/76911134/is-it-possible-to-get-the-rust-rocket-500-error-message
System Checks
The text was updated successfully, but these errors were encountered: