show non-fatal setup errors on home screen instead of in popup

This commit is contained in:
Joseph Montanaro committed 2023-09-14 15:13:19 -07:00
1 parent 12f0f187a6
commit 992d2a4d06
11 files changed
+62 -12

No files matched your search

+9
View File
@@ -22,6 +22,7 @@ use serde::{Serialize, Serializer, ser::SerializeMap};
pub trait ErrorPopup {
fn error_popup(self, title: &str);
fn error_popup_nowait(self, title: &str);
}
impl<E: std::fmt::Display> ErrorPopup for Result<(), E> {
@@ -35,6 +36,14 @@ impl<E: std::fmt::Display> ErrorPopup for Result<(), E> {
rx.recv().unwrap();
}
}
fn error_popup_nowait(self, title: &str) {
if let Err(e) = self {
MessageDialogBuilder::new(title, format!("{e}"))
.kind(MessageDialogKind::Error)
.show(|_| {})
}
}
}