diff --git a/crates/core/src/watcher/file_watcher.rs b/crates/core/src/watcher/file_watcher.rs index 795be03..1d03abd 100644 --- a/crates/core/src/watcher/file_watcher.rs +++ b/crates/core/src/watcher/file_watcher.rs @@ -13,6 +13,7 @@ pub enum FileEvent { Truncated { new_size: u64 }, Rotated { new_inode: u64 }, Removed, + WatcherError { message: String }, } // ─── get_inode ────────────────────────────────────────────────────────────── @@ -56,7 +57,12 @@ impl FileWatcher { notify::recommended_watcher(move |res: std::result::Result| { let event = match res { Ok(e) => e, - Err(_) => return, + Err(error) => { + let _ = tx.try_send(FileEvent::WatcherError { + message: error.to_string(), + }); + return; + } }; match event.kind { @@ -232,5 +238,19 @@ mod tests { let d = FileEvent::Rotated { new_inode: 42 }; assert_ne!(a, d); + + let e1 = FileEvent::WatcherError { + message: "io error".into(), + }; + let e2 = FileEvent::WatcherError { + message: "io error".into(), + }; + assert_eq!(e1, e2); + assert_ne!( + e1, + FileEvent::WatcherError { + message: "other".into() + } + ); } } \ No newline at end of file diff --git a/crates/tui/src/app.rs b/crates/tui/src/app.rs index cc882df..5ba9c2f 100644 --- a/crates/tui/src/app.rs +++ b/crates/tui/src/app.rs @@ -857,6 +857,7 @@ impl App { FileEvent::Removed => { self.loading_state = AppLoadingState::Error("File has been deleted".into()); } + FileEvent::WatcherError { message: _ } => {} } } }