Remove noisy panic handler.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
feaeded719
commit
d415345d2f
|
@ -24,7 +24,6 @@ features = [
|
||||||
]
|
]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
backtrace = "0.3"
|
|
||||||
bevy_rapier2d = "0.21"
|
bevy_rapier2d = "0.21"
|
||||||
bevy_synthizer = "0.2"
|
bevy_synthizer = "0.2"
|
||||||
bevy_tts = { version = "0.5", default-features = false, features = ["tolk"] }
|
bevy_tts = { version = "0.5", default-features = false, features = ["tolk"] }
|
||||||
|
|
|
@ -49,5 +49,4 @@ It provides, including but not limited to:
|
||||||
* utils
|
* 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
|
* 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
|
* error
|
||||||
* Logger for logging panic stacktraces
|
* Logger for logging errors in systems
|
||||||
* Panic handler for sending stacktraces to [Sentry](https://sentry.io) in release builds
|
|
||||||
|
|
44
src/error.rs
44
src/error.rs
|
@ -1,7 +1,5 @@
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::{panic, thread};
|
|
||||||
|
|
||||||
use backtrace::Backtrace;
|
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
|
|
||||||
pub fn error_handler(In(result): In<Result<(), Box<dyn Error>>>) {
|
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);
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user