log path errors

This commit is contained in:
Evan Almloff committed 2023-01-12 11:10:16 -06:00
1 parent 4e180bd19e
commit 97b9f422e1
1 file changed
+16 -3
+16 -3
View File
@@ -67,9 +67,22 @@ pub fn init<Ctx: HotReloadingContext + Send + 'static>(
let mut watcher = RecommendedWatcher::new(tx, notify::Config::default()).unwrap();
for path in listening_paths {
if let Ok(path) = PathBuf::from_str(path) {
let examples_path = crate_dir.join(path);
let _ = watcher.watch(&examples_path, RecursiveMode::Recursive);
match PathBuf::from_str(path) {
Ok(path) => {
let full_path = crate_dir.join(path);
if let Err(err) = watcher.watch(&full_path, RecursiveMode::Recursive) {
if log {
println!(
"hot reloading failed to start watching {full_path:?}:\n{err:?}",
);
}
}
}
Err(err) => {
if log {
println!("hot reloading failed to create path:\n{:?}", err);
}
}
}
}