Skip to content

Commit 72d13f5

Browse files
authored
Add module info to crash report (#230)
* Also write module info on crash report * Remove unneeded return
1 parent 517eabf commit 72d13f5

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/lib.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,17 @@ pub fn base_info_func(
6767
for_crash_report: bool,
6868
extended_info_func: Option<fn(&InfoContext, bool)>,
6969
) {
70-
if !for_crash_report {
71-
if let Some(func) = extended_info_func {
72-
func(ctx, for_crash_report);
73-
return;
70+
// If needed, add rust trace into the crash report (before module info)
71+
if for_crash_report {
72+
if ctx.add_info_section(Some("trace")) == Status::Ok {
73+
let current_backtrace = Backtrace::new();
74+
let trace = format!("{:?}", current_backtrace);
75+
ctx.add_info_field_str("trace", &trace);
7476
}
7577
}
76-
// add rust trace into the crash report
77-
if ctx.add_info_section(Some("trace")) == Status::Ok {
78-
let current_backtrace = Backtrace::new();
79-
let trace = format!("{:?}", current_backtrace);
80-
ctx.add_info_field_str("trace", &trace);
78+
79+
if let Some(func) = extended_info_func {
80+
// Add module info
81+
func(ctx, for_crash_report);
8182
}
8283
}

0 commit comments

Comments
 (0)