From b41df422f66b0511ecd9490b3ce4b695567b81cf Mon Sep 17 00:00:00 2001 From: Shaun S Date: Thu, 13 Oct 2022 17:12:11 +0800 Subject: [PATCH 1/2] Chain the existing panic_hook onto Rollbar reporting --- src/lib.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index dfd90d09..e43934c3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,14 +69,22 @@ macro_rules! report_error_message { #[macro_export] macro_rules! report_panics { ($client:ident) => {{ - ::std::panic::set_hook(::std::boxed::Box::new(move |panic_info| { - let backtrace = $crate::backtrace::Backtrace::new(); - $client - .build_report() - .from_panic(panic_info) - .with_backtrace(&backtrace) - .send(); - })) + static INIT: ::std::sync::Once = ::std::sync::Once::new(); + INIT.call_once(|| { + let panic_hook = ::std::panic::take_hook(); + + ::std::panic::set_hook(::std::boxed::Box::new(move |panic_info| { + let backtrace = $crate::backtrace::Backtrace::new(); + + $client + .build_report() + .from_panic(panic_info) + .with_backtrace(&backtrace) + .send(); + + panic_hook(panic_info); + })) + }) }}; } From b5ffe3b387e98d0ca2d8676e135fbd41045d6bec Mon Sep 17 00:00:00 2001 From: Shaun S Date: Thu, 13 Oct 2022 17:23:40 +0800 Subject: [PATCH 2/2] Bump version to 0.7.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 40e9fd39..844c9cc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rollbar" -version = "0.7.0" +version = "0.7.1" authors = ["Giovanni Capuano