log errors instead of panicing on io errors
This commit is contained in:
1 parent
09703ef858
commit
bfbda510fe
3 files changed
+251
-329
No files matched your search
Generated
+228
-303
File diff suppressed because it is too large.
Load diff
+7
-15
@@ -76,23 +76,15 @@ ctrlc = "3.2.3"
|
|||||||
# dioxus-rsx = "0.0.1"
|
# dioxus-rsx = "0.0.1"
|
||||||
gitignore = "1.0.7"
|
gitignore = "1.0.7"
|
||||||
|
|
||||||
dioxus-rsx = { path = "../../dioxus/packages/rsx" }
|
dioxus-rsx = { git = "https://github.com/DioxusLabs/dioxus" }
|
||||||
dioxus-html = { path = "../../dioxus/packages/html", features = [
|
dioxus-html = { git = "https://github.com/DioxusLabs/dioxus", features = [
|
||||||
"hot-reload-context",
|
"hot-reload-context",
|
||||||
] }
|
] }
|
||||||
dioxus-core = { path = "../../dioxus/packages/core", features = ["serialize"] }
|
dioxus-core = { git = "https://github.com/DioxusLabs/dioxus", features = [
|
||||||
dioxus-autofmt = { path = "../../dioxus/packages/autofmt" }
|
"serialize",
|
||||||
rsx-rosetta = { path = "../../dioxus/packages/rsx-rosetta" }
|
] }
|
||||||
|
dioxus-autofmt = { git = "https://github.com/dioxuslabs/dioxus" }
|
||||||
# dioxus-rsx = { git = "https://github.com/DioxusLabs/dioxus" }
|
rsx-rosetta = { git = "https://github.com/dioxuslabs/dioxus" }
|
||||||
# dioxus-html = { git = "https://github.com/DioxusLabs/dioxus", features = [
|
|
||||||
# "hot-reload-context",
|
|
||||||
# ] }
|
|
||||||
# dioxus-core = { git = "https://github.com/DioxusLabs/dioxus", features = [
|
|
||||||
# "serialize",
|
|
||||||
# ] }
|
|
||||||
# dioxus-autofmt = { git = "https://github.com/dioxuslabs/dioxus" }
|
|
||||||
# rsx-rosetta = { git = "https://github.com/dioxuslabs/dioxus" }
|
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|||||||
+16
-11
@@ -136,9 +136,11 @@ pub async fn startup_hot_reload(ip: String, port: u16, config: CrateConfig) -> R
|
|||||||
|
|
||||||
let dist_path = config.out_dir.clone();
|
let dist_path = config.out_dir.clone();
|
||||||
let (reload_tx, _) = broadcast::channel(100);
|
let (reload_tx, _) = broadcast::channel(100);
|
||||||
let file_map = Arc::new(Mutex::new(FileMap::<HtmlCtx>::new(
|
let FileMapBuildResult { map, errors } = FileMap::<HtmlCtx>::create(config.crate_dir.clone())?;
|
||||||
config.crate_dir.clone(),
|
for err in errors {
|
||||||
)));
|
log::error!("{}", err);
|
||||||
|
}
|
||||||
|
let file_map = Arc::new(Mutex::new(map));
|
||||||
let build_manager = Arc::new(BuildManager {
|
let build_manager = Arc::new(BuildManager {
|
||||||
config: config.clone(),
|
config: config.clone(),
|
||||||
reload_tx: reload_tx.clone(),
|
reload_tx: reload_tx.clone(),
|
||||||
@@ -185,10 +187,10 @@ pub async fn startup_hot_reload(ip: String, port: u16, config: CrateConfig) -> R
|
|||||||
let mut map = file_map.lock().unwrap();
|
let mut map = file_map.lock().unwrap();
|
||||||
|
|
||||||
match map.update_rsx(&path, &crate_dir) {
|
match map.update_rsx(&path, &crate_dir) {
|
||||||
UpdateResult::UpdatedRsx(msgs) => {
|
Ok(UpdateResult::UpdatedRsx(msgs)) => {
|
||||||
messages.extend(msgs);
|
messages.extend(msgs);
|
||||||
}
|
}
|
||||||
UpdateResult::NeedsRebuild => {
|
Ok(UpdateResult::NeedsRebuild) => {
|
||||||
match build_manager.rebuild() {
|
match build_manager.rebuild() {
|
||||||
Ok(res) => {
|
Ok(res) => {
|
||||||
print_console_info(
|
print_console_info(
|
||||||
@@ -208,6 +210,9 @@ pub async fn startup_hot_reload(ip: String, port: u16, config: CrateConfig) -> R
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Err(err) => {
|
||||||
|
log::error!("{}", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for msg in messages {
|
for msg in messages {
|
||||||
@@ -222,12 +227,12 @@ pub async fn startup_hot_reload(ip: String, port: u16, config: CrateConfig) -> R
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
for sub_path in allow_watch_path {
|
for sub_path in allow_watch_path {
|
||||||
watcher
|
if let Err(err) = watcher.watch(
|
||||||
.watch(
|
&config.crate_dir.join(&sub_path),
|
||||||
&config.crate_dir.join(sub_path),
|
notify::RecursiveMode::Recursive,
|
||||||
notify::RecursiveMode::Recursive,
|
) {
|
||||||
)
|
log::error!("error watching {sub_path:?}: \n{}", err);
|
||||||
.unwrap();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// start serve dev-server at 0.0.0.0:8080
|
// start serve dev-server at 0.0.0.0:8080
|
||||||
|
|||||||
Reference in new issue
Block a user