From dcfe7920324fed10072c75f8a26fdaf94d1e4679 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Tue, 3 Aug 2021 09:00:37 -0500 Subject: [PATCH] display String panic msgs as well as &str ones For #136. I'm also going to make this particular case no longer panic, but there will surely be other affected panics. Before: ``` E20210803 08:58:31.606 main moonfire_nvr] panic at '/Users/slamb/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.10/src/server/server.rs:68:17' ``` After: ``` E20210803 08:59:51.319 main moonfire_nvr] panic at '/Users/slamb/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.10/src/server/server.rs:68:17': error binding to 0.0.0.0:80: error creating server listener: Address already in use (os error 48) ``` --- server/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/main.rs b/server/src/main.rs index 3e99556..c14b5a4 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -87,6 +87,8 @@ fn panic_hook(p: &std::panic::PanicInfo) { } if let Some(s) = p.payload().downcast_ref::<&str>() { write!(&mut msg, ": {}", s).unwrap(); + } else if let Some(s) = p.payload().downcast_ref::() { + write!(&mut msg, ": {}", s).unwrap(); } let b = failure::Backtrace::new(); if b.is_empty() {