Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix custom panic handler (pantsbuild#4884)
The custom panic handler was previously assuming that the payload of a panic was of type &str, and calling .unwrap() on the result of downcast_ref::<&str>. However, depending on how panic! was invoked, the type of the payload may be &str, String, or in principle some other type. Since there are cases in the pants codebase where panic! is invoked with format!-style macros, resuling in a String rather than &str payload, these panics induced an additional panic in the .unwrap(), which displayed "thread panicked while processing panic" and aborted, rather than showing the proper error message. This is fixed by removing the .unwrap() and explicitly handling all possible cases.
- Loading branch information