-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add a panic hook to collect logs and show a dialog (#191)
- Loading branch information
1 parent
3c48bb6
commit f23eb73
Showing
4 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use std::sync::{Arc, Barrier}; | ||
use tauri::api::dialog::{MessageDialogBuilder, MessageDialogButtons, MessageDialogKind}; | ||
|
||
pub fn panic_dialog(msg: &str) { | ||
let msg = format!( | ||
"{}\n\nPlease report this issue to Github issue tracker.", | ||
msg | ||
); | ||
let barrier = Arc::new(Barrier::new(2)); | ||
let barrier_ref = barrier.clone(); | ||
MessageDialogBuilder::new("Error", msg) | ||
.kind(MessageDialogKind::Error) | ||
.buttons(MessageDialogButtons::Ok) | ||
.show(move |_| { | ||
barrier_ref.wait(); | ||
}); | ||
barrier.wait(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod candy; | ||
pub mod dialog; | ||
pub mod dirs; | ||
pub mod help; | ||
pub mod init; | ||
|