From d415345d2f14542a7d2a42b3cc7bf3bf89187fb8 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Thu, 30 Mar 2023 11:45:45 -0500 Subject: [PATCH] Remove noisy panic handler. --- Cargo.toml | 1 - README.md | 3 +-- src/error.rs | 44 -------------------------------------------- 3 files changed, 1 insertion(+), 47 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7647300..cbfd7c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,6 @@ features = [ ] [dependencies] -backtrace = "0.3" bevy_rapier2d = "0.21" bevy_synthizer = "0.2" bevy_tts = { version = "0.5", default-features = false, features = ["tolk"] } diff --git a/README.md b/README.md index 9b2ac77..46fde7c 100644 --- a/README.md +++ b/README.md @@ -49,5 +49,4 @@ It provides, including but not limited to: * utils * Poorly-named `target_and_other` function for taking 2 entities, a predecate, and returning `Some((match, other))` if one matches or `None` if neither do. Good for, say, taking in a collision pair and returning a bullet entity first * error - * Logger for logging panic stacktraces - * Panic handler for sending stacktraces to [Sentry](https://sentry.io) in release builds \ No newline at end of file + * Logger for logging errors in systems diff --git a/src/error.rs b/src/error.rs index cd8c8f0..85681b2 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,7 +1,5 @@ use std::error::Error; -use std::{panic, thread}; -use backtrace::Backtrace; use bevy::prelude::*; pub fn error_handler(In(result): In>>) { @@ -9,45 +7,3 @@ pub fn error_handler(In(result): In>>) { error!("{}", e); } } - -fn init_panic_handler() { - panic::set_hook(Box::new(|info| { - let backtrace = Backtrace::default(); - let thread = thread::current(); - let thread = thread.name().unwrap_or(""); - let msg = match info.payload().downcast_ref::<&'static str>() { - Some(s) => *s, - None => match info.payload().downcast_ref::() { - Some(s) => &**s, - None => "Box", - }, - }; - match info.location() { - Some(location) => { - error!( - target: "panic", "thread '{}' panicked at '{}': {}:{}{:?}", - thread, - msg, - location.file(), - location.line(), - backtrace - ); - } - None => error!( - target: "panic", - "thread '{}' panicked at '{}'{:?}", - thread, - msg, - backtrace - ), - } - })); -} - -pub struct ErrorPlugin; - -impl Plugin for ErrorPlugin { - fn build(&self, _app: &mut App) { - init_panic_handler(); - } -}