2020-12-12 08:31:46 -08:00
|
|
|
#[allow(unused_imports)]
|
2020-12-08 15:40:04 -08:00
|
|
|
use sentry::{
|
|
|
|
integrations::backtrace::current_stacktrace,
|
|
|
|
protocol::{Event, Exception, Mechanism},
|
|
|
|
};
|
|
|
|
|
|
|
|
pub fn panic_event_from<T>(msg: T) -> Event<'static>
|
|
|
|
where
|
|
|
|
T: ToString,
|
|
|
|
{
|
|
|
|
let exception = Exception {
|
|
|
|
ty: "panic".into(),
|
|
|
|
mechanism: Some(Mechanism {
|
|
|
|
ty: "panic".into(),
|
|
|
|
handled: Some(false),
|
|
|
|
..Default::default()
|
|
|
|
}),
|
|
|
|
value: Some(msg.to_string()),
|
2020-12-12 08:31:46 -08:00
|
|
|
// Sentry does not handle panic = abort well yet, and when gibven this
|
|
|
|
// stacktrace, it consists only of this line, making Sentry dedupe
|
|
|
|
// events together by their stacetrace fingerprint incorrectly.
|
|
|
|
//
|
|
|
|
// stacktrace: current_stacktrace(),
|
2020-12-08 15:40:04 -08:00
|
|
|
..Default::default()
|
|
|
|
};
|
|
|
|
|
|
|
|
Event {
|
|
|
|
exception: vec![exception].into(),
|
|
|
|
level: sentry::Level::Fatal,
|
|
|
|
..Default::default()
|
|
|
|
}
|
|
|
|
}
|