diff --git a/melib/src/backends.rs b/melib/src/backends.rs index 8b6bb4a42..422b0f45f 100644 --- a/melib/src/backends.rs +++ b/melib/src/backends.rs @@ -94,6 +94,7 @@ pub enum RefreshEventKind { Create(Box), Remove(FolderHash), Rescan, + Failure(MeliError), } #[derive(Debug)] diff --git a/ui/src/conf/accounts.rs b/ui/src/conf/accounts.rs index fa8d94ed4..77002ac1d 100644 --- a/ui/src/conf/accounts.rs +++ b/ui/src/conf/accounts.rs @@ -355,7 +355,12 @@ impl Account { })); Some(w) } - pub fn reload(&mut self, event: RefreshEvent, folder_hash: FolderHash) -> Option { + pub fn reload( + &mut self, + event: RefreshEvent, + folder_hash: FolderHash, + sender: &chan::Sender, + ) -> Option { if !self.folders[&folder_hash].is_available() { self.event_queue.push_back((folder_hash, event)); return None; @@ -424,6 +429,13 @@ impl Account { ); self.workers.insert(folder_hash, handle); } + RefreshEventKind::Failure(e) => { + debug!("RefreshEvent Failure: {}", e.to_string()); + let sender = sender.clone(); + self.watch(RefreshEventConsumer::new(Box::new(move |r| { + sender.send(crate::types::ThreadEvent::from(r)); + }))); + } } } None diff --git a/ui/src/state.rs b/ui/src/state.rs index c0345cfe7..9fd5ae470 100644 --- a/ui/src/state.rs +++ b/ui/src/state.rs @@ -277,7 +277,9 @@ impl State { self.context.replies.push_back(UIEvent::from(event)); return; } - if let Some(notification) = self.context.accounts[idxa].reload(event, hash) { + if let Some(notification) = + self.context.accounts[idxa].reload(event, hash, &self.context.sender) + { if let UIEvent::Notification(_, _) = notification { self.context .replies