ShowMenu: Add debug assertions here too.

This commit is contained in:
Jordan Petridis 2018-07-21 10:30:46 +03:00
parent b5ddca65f5
commit b9bcc28e0f
No known key found for this signature in database
GPG Key ID: CEABAD9F5683B9A6

View File

@ -60,10 +60,8 @@ impl ShowMenu {
self.website.connect_clicked(clone!(pd => move |_| { self.website.connect_clicked(clone!(pd => move |_| {
let link = pd.link(); let link = pd.link();
info!("Opening link: {}", link); info!("Opening link: {}", link);
open::that(link) let res = open::that(link);
.map_err(|err| error!("Error: {}", err)) debug_assert!(res.is_ok());
.map_err(|_| error!("Failed open link: {}", link))
.ok();
})); }));
} }
@ -132,9 +130,8 @@ fn mark_all_watched(pd: &Show, sender: &Sender<Action>) -> Result<(), Error> {
pub fn mark_all_notif(pd: Arc<Show>, sender: &Sender<Action>) -> InAppNotification { pub fn mark_all_notif(pd: Arc<Show>, sender: &Sender<Action>) -> InAppNotification {
let id = pd.id(); let id = pd.id();
let callback = clone!(sender => move || { let callback = clone!(sender => move || {
mark_all_watched(&pd, &sender) let res = mark_all_watched(&pd, &sender);
.map_err(|err| error!("Notif Callback Error: {}", err)) debug_assert!(res.is_ok());
.ok();
glib::Continue(false) glib::Continue(false)
}); });
@ -146,16 +143,12 @@ pub fn mark_all_notif(pd: Arc<Show>, sender: &Sender<Action>) -> InAppNotificati
pub fn remove_show_notif(pd: Arc<Show>, sender: Sender<Action>) -> InAppNotification { pub fn remove_show_notif(pd: Arc<Show>, sender: Sender<Action>) -> InAppNotification {
let text = format!("Unsubscribed from {}", pd.title()); let text = format!("Unsubscribed from {}", pd.title());
utils::ignore_show(pd.id()) let res = utils::ignore_show(pd.id());
.map_err(|err| error!("Error: {}", err)) debug_assert!(res.is_ok());
.map_err(|_| error!("Could not insert {} to the ignore list.", pd.title()))
.ok();
let callback = clone!(pd, sender => move || { let callback = clone!(pd, sender => move || {
utils::uningore_show(pd.id()) let res = utils::uningore_show(pd.id());
.map_err(|err| error!("Error: {}", err)) debug_assert!(res.is_ok());
.map_err(|_| error!("Could not remove {} from the ignore list.", pd.title()))
.ok();
// Spawn a thread so it won't block the ui. // Spawn a thread so it won't block the ui.
rayon::spawn(clone!(pd, sender => move || { rayon::spawn(clone!(pd, sender => move || {
@ -170,9 +163,8 @@ pub fn remove_show_notif(pd: Arc<Show>, sender: Sender<Action>) -> InAppNotifica
}); });
let undo_callback = move || { let undo_callback = move || {
utils::uningore_show(pd.id()) let res = utils::uningore_show(pd.id());
.map_err(|err| error!("{}", err)) debug_assert!(res.is_ok());
.ok();
sender.send(Action::RefreshShowsView); sender.send(Action::RefreshShowsView);
sender.send(Action::RefreshEpisodesView); sender.send(Action::RefreshEpisodesView);
}; };