From 4034ef8d794b9aa659e76de61eb0763152056421 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Sun, 11 Oct 2020 00:48:08 -0700 Subject: [PATCH] web: Use PanicInfo::to_string for displaying panic info PanicInfo::payload wasn't giving anything useful (just resulted in 'Unknown error') -- to_string displays all of the message, payload, and location of the panic. Particularly the location is helpful. --- web/src/lib.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/web/src/lib.rs b/web/src/lib.rs index 6bde8c63e..e603acb72 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -875,11 +875,7 @@ pub fn set_panic_handler() { RUFFLE_GLOBAL_PANIC.call_once(|| { console_error_panic_hook::hook(info); - let error = JsError::new( - info.payload() - .downcast_ref::<&str>() - .unwrap_or(&"Unknown panic"), - ); + let error = JsError::new(&info.to_string()); let _ = INSTANCES.try_with(|instances| { let mut players = Vec::new();