How to prevent: thread panicked while processing panic. aborting

One of my users has reported having this error message:
thread panicked while processing panic. aborting.
Even with the same data on the same OS I can't reproduce the bug.

Here's my main():

fn main() {
    panic::set_hook(Box::new(|info| {
            "Unexpected error: {}",
        if let Some(location) = info.location() {
            eprint!(" ({} {})", location.file(), location.line());
    let code = real_main(); // returns an i32

I thought this would catch all panics and at least cleanly exit, but it seems not. Is it possible to make it catch any panic and at least cleanly exit. Ideally saying why/where it panicked?

This unwrap may be panicing. According to the docs, payload "will commonly, but not always, be a &'static str or String ." If it's a String, then your downcast_ref will return None.

Thanks! I don't know how I missed that.