Remove noisy panic handler.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Nolan Darilek 2023-03-30 11:45:45 -05:00
parent feaeded719
commit d415345d2f
3 changed files with 1 additions and 47 deletions

View File

@ -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"] }

View File

@ -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
* Logger for logging errors in systems

View File

@ -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<Result<(), Box<dyn Error>>>) {
@ -9,45 +7,3 @@ pub fn error_handler(In(result): In<Result<(), Box<dyn Error>>>) {
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("<unnamed>");
let msg = match info.payload().downcast_ref::<&'static str>() {
Some(s) => *s,
None => match info.payload().downcast_ref::<String>() {
Some(s) => &**s,
None => "Box<Any>",
},
};
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();
}
}