Skip to content

Commit 1f0be60

Browse files
authored
fix(anyhow): attach stacktrace only if error provides backtrace (#759)
1 parent a995b9b commit 1f0be60

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sentry-anyhow/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ pub fn event_from_error(err: &anyhow::Error) -> Event<'static> {
7272
// exception records are sorted in reverse
7373
if let Some(exc) = event.exception.iter_mut().last() {
7474
let backtrace = err.backtrace();
75-
exc.stacktrace = sentry_backtrace::parse_stacktrace(&format!("{backtrace:#}"));
75+
if matches!(
76+
backtrace.status(),
77+
std::backtrace::BacktraceStatus::Captured
78+
) {
79+
exc.stacktrace = sentry_backtrace::parse_stacktrace(&format!("{backtrace:#}"));
80+
}
7681
}
7782
}
7883

0 commit comments

Comments
 (0)