فهرست منبع

log path errors

Evan Almloff 2 سال پیش
والد
کامیت
97b9f422e1
1فایلهای تغییر یافته به همراه16 افزوده شده و 3 حذف شده
  1. 16 3
      packages/hot-reload/src/lib.rs

+ 16 - 3
packages/hot-reload/src/lib.rs

@@ -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);
+                            }
+                        }
                     }
                 }