Skip to content

Commit

Permalink
#159 show panic error on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
angel-git committed May 13, 2024
1 parent 6a752e0 commit f38460f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ pub struct MutexState {
}

fn main() {
std::panic::set_hook(Box::new(|info| {
error!("Panic: {:?}", info);
}));
let apta_key = load_apta_key();
tauri::Builder::default()
.plugin(tauri_plugin_aptabase::Builder::new(apta_key.as_str()).build())
Expand Down Expand Up @@ -88,6 +85,12 @@ fn main() {
update_selected_menu_telemetry(main_window.menu_handle(), telemetry_selected);
update_selected_menu_locale(main_window.menu_handle(), locale_id);
internal_state.store = Some(store);

std::panic::set_hook(Box::new(move |info| {
error!("Panic: {:?}", info);
main_window.emit("error", info.to_string()).unwrap()
}));

Ok(())
})
.invoke_handler(tauri::generate_handler![
Expand Down

0 comments on commit f38460f

Please sign in to comment.