notify-rs / notify

🔭 Cross-platform filesystem notification library for Rust.
https://docs.rs/notify
2.77k stars 222 forks source link

Make `ErrorKind::PathNotFound` consistent on inotify #611

Closed y5c4l3 closed 4 months ago

y5c4l3 commented 4 months ago

Before this patch, watching a nonexistent path using inotify backend would give an ErrorKind::Io variant. This behavior was inconsistent with other backends.

I am not sure if this is expected but taking #110 into consideration I think the path error ought to be consistent.

Run the inotify watcher on Linux:

let error = watcher.watch(Path::new("/nonexistent"), notify::RecursiveMode::Recursive).unwrap_err();

Before:

Error { kind: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" }), paths: [] }

After:

Error { kind: PathNotFound, paths: [] }
0xpr03 commented 4 months ago

Thanks!