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

This commit is contained in:
Joseph Montanaro
2023-09-14 15:04:25 -07:00
parent 12f0f187a6
commit 992d2a4d06
11 changed files with 62 additions and 12 deletions

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(|_| {})
}
}
}