forked from nonsensical-dev/zenyx-engine
show dialog on panic
This commit is contained in:
parent
7596058c85
commit
10932a1a97
6 changed files with 319 additions and 6 deletions
|
@ -3,8 +3,10 @@ use std::fmt::Write as FmtWrite;
|
|||
use std::mem;
|
||||
|
||||
use backtrace::Backtrace;
|
||||
use native_dialog::{MessageDialog, MessageType};
|
||||
use parking_lot::Once;
|
||||
use regex::Regex;
|
||||
use tracing::error;
|
||||
|
||||
static INIT: parking_lot::Once = Once::new();
|
||||
|
||||
|
@ -48,7 +50,7 @@ fn process_panic(info: &std::panic::PanicHookInfo<'_>) -> Result<(), Box<dyn Err
|
|||
let panic_msg = format!(
|
||||
"Zenyx had a problem and crashed. To help us diagnose the problem you can send us a crash report.
|
||||
|
||||
We have generated a report file at \"{}\". Submit an issue or email with the subject of \"Zenyx Crash Report\" and include the report as an attachment.
|
||||
We have generated a report file at '{}'. Submit an issue or email with the subject of 'Zenyx Crash Report' and include the report as an attachment.
|
||||
|
||||
To submit the crash report:
|
||||
|
||||
|
@ -62,6 +64,14 @@ Thank you kindly!", log_path.display());
|
|||
"\nFor future reference, the error summary is as follows:\n{}",
|
||||
payload_str.red().bold()
|
||||
);
|
||||
if let Err(e ) = MessageDialog::new()
|
||||
.set_type(MessageType::Error)
|
||||
.set_title(&format!("{}",payload_str))
|
||||
// wont display properly if not debug formatted??
|
||||
.set_text(&format!("{:#?}", panic_msg))
|
||||
.show_alert() {
|
||||
error!("{e}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue