Skip to content

Commit

Permalink
Add module info to crash report (#230)
Browse files Browse the repository at this point in the history
* Also write module info on crash report

* Remove unneeded return
  • Loading branch information
oshadmi authored May 31, 2022
1 parent 517eabf commit 72d13f5
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,17 @@ pub fn base_info_func(
for_crash_report: bool,
extended_info_func: Option<fn(&InfoContext, bool)>,
) {
if !for_crash_report {
if let Some(func) = extended_info_func {
func(ctx, for_crash_report);
return;
// If needed, add rust trace into the crash report (before module info)
if for_crash_report {
if ctx.add_info_section(Some("trace")) == Status::Ok {
let current_backtrace = Backtrace::new();
let trace = format!("{:?}", current_backtrace);
ctx.add_info_field_str("trace", &trace);
}
}
// add rust trace into the crash report
if ctx.add_info_section(Some("trace")) == Status::Ok {
let current_backtrace = Backtrace::new();
let trace = format!("{:?}", current_backtrace);
ctx.add_info_field_str("trace", &trace);

if let Some(func) = extended_info_func {
// Add module info
func(ctx, for_crash_report);
}
}

0 comments on commit 72d13f5

Please sign in to comment.