"thread panicked while processing panic" when using "bail!"

Hi,

I have an async fn my_func() -> anyhow::Result<()> that I run using Tokio's block_on.
In this async fn, when I use anyhow::bail macro, I'm ending with this "thread panicked while processing panic. aborting" error.

I don't understand what's happening and how to have a cleaner error output

That error message happens if the program panics, and then during that panic, it panics again, typically in the destructor of one of the variables that are dropped due to the panic.

Thank you! Might be something with the slog logger I use then. I'm using slog_scope to avoid passing a logger around. Maybe it's dropped but in my panic hook I wanted to log the issue hence double panic.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.