Skip to content

Commit

Permalink
Fix some stuff that I forgot
Browse files Browse the repository at this point in the history
  • Loading branch information
ktwrd committed Jun 6, 2024
1 parent 7a4fd12 commit f4764a1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ fn init_panic_handle()
{
std::panic::set_hook(Box::new(move |info| {
debug!("[panic::set_hook] showing msgbox to notify user");
custom_panic_handle(info.message().into());
let mut x = String::new();
if let Some(m) = info.message() {
x = format!("{:#?}", m);
}
custom_panic_handle(x);
debug!("[panic::set_hook] calling sentry_panic::panic_handler");
sentry::integrations::panic::panic_handler(&info);
if flags::has_flag(LaunchFlag::DEBUG_MODE) {
Expand All @@ -63,12 +67,12 @@ fn init_panic_handle()
logic_done();
}));
}
fn custom_panic_handle(msg: Option<String>)
fn custom_panic_handle(msg: String)
{
unsafe {
if beans_rs::PAUSE_ONCE_DONE {
std::thread::spawn(|| {
let txt = PANIC_MSG_CONTENT.to_string().replace("$err_msg", &msg.unwrap_or("".to_string()));
std::thread::spawn(move || {
let txt = PANIC_MSG_CONTENT.to_string().replace("$err_msg", &msg);
let d = native_dialog::MessageDialog::new()
.set_type(native_dialog::MessageType::Error)
.set_title("beans - fatal error!")
Expand Down Expand Up @@ -187,7 +191,7 @@ impl Launcher
pub fn set_no_pause(&mut self)
{
unsafe {
PAUSE_ONCE_DONE = self.root_matches.get_flag("no-pause") == false;
beans_rs::PAUSE_ONCE_DONE = self.root_matches.get_flag("no-pause") == false;
}
}

Expand Down

0 comments on commit f4764a1

Please sign in to comment.