소스 검색

fix: don't panic while reading file in hotreload (#3142)

Jonathan Kelley 8 달 전
부모
커밋
a35655a457
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      packages/cli/src/serve/runner.rs

+ 7 - 1
packages/cli/src/serve/runner.rs

@@ -188,7 +188,13 @@ impl AppRunner {
             };
 
             // And grabout the contents
-            let contents = std::fs::read_to_string(&rust_file).unwrap();
+            let Ok(contents) = std::fs::read_to_string(&rust_file) else {
+                tracing::debug!(
+                    "Failed to read rust file while hotreloading: {:?}",
+                    rust_file
+                );
+                continue;
+            };
 
             match self.file_map.update_rsx::<HtmlCtx>(path, contents) {
                 HotreloadResult::Rsx(new) => templates.extend(new),