From 116be16392fb048b0f7614e04c581624c39e0f90 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Tue, 27 Mar 2018 00:50:44 -0700 Subject: [PATCH] Improve error message when a partition target doesn't exist. Closes #46 --- src/vfs/vfs_watcher.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/vfs/vfs_watcher.rs b/src/vfs/vfs_watcher.rs index f5d50174..9ace5262 100644 --- a/src/vfs/vfs_watcher.rs +++ b/src/vfs/vfs_watcher.rs @@ -78,11 +78,14 @@ impl VfsWatcher { let (tx, rx) = mpsc::channel(); let mut watcher: RecommendedWatcher = Watcher::new(tx, Duration::from_secs(1)) - .expect("Unable to create watcher!"); + .expect("Unable to create watcher! This is a bug in Rojo."); - watcher - .watch(&root_path, RecursiveMode::Recursive) - .expect("Unable to watch path!"); + match watcher.watch(&root_path, RecursiveMode::Recursive) { + Ok(_) => (), + Err(_) => { + panic!("Unable to watch partition {}, with path {}! Make sure that it's a file or directory.", partition_name, root_path.display()); + }, + } watchers.push(watcher);