add more error logging

This commit is contained in:
2025-08-25 23:22:56 +02:00
parent f230d455f2
commit ad582caa5b
3 changed files with 18 additions and 6 deletions

2
Cargo.lock generated
View File

@@ -243,7 +243,7 @@ checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
[[package]] [[package]]
name = "webTemplate" name = "webTemplate"
version = "0.4.0" version = "0.4.1"
dependencies = [ dependencies = [
"hashlink", "hashlink",
"minijinja", "minijinja",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "webTemplate" name = "webTemplate"
version = "0.4.0" version = "0.4.1"
edition = "2024" edition = "2024"
[dependencies] [dependencies]

View File

@@ -60,7 +60,12 @@ fn render_index(
}; };
let dest_path: &Path = &cur_path.join(format!("{}.{}", friendly, extention)); let dest_path: &Path = &cur_path.join(format!("{}.{}", friendly, extention));
// render the content // render the content
println!("INFO: render {}", dest_path.to_str().unwrap()); let dest_path_str = dest_path.to_str();
if dest_path_str == None {
println!("ERROR: dest path is None for page: {}", friendly);
return;
}
println!("INFO: render {}", dest_path_str.unwrap());
match site_index.render_page(index, &site_index.site, jinja_env) { match site_index.render_page(index, &site_index.site, jinja_env) {
Some(content) => { Some(content) => {
let _ = fs::write(dest_path, content); let _ = fs::write(dest_path, content);
@@ -70,10 +75,17 @@ fn render_index(
} }
else { else {
// file is an asset, no rendering done for assets // file is an asset, no rendering done for assets
let dest_path: &Path = &cur_path.join(friendly); let dest_path: &Path = &cur_path.join(friendly.clone());
println!("INFO: copy {}", dest_path.to_str().unwrap()); match dest_path.to_str() {
Some(dest_path_str) => {
println!("INFO: copy {}", dest_path_str);
let _ = fs::copy(src, dest_path); let _ = fs::copy(src, dest_path);
} }
None => {
println!("ERROR: dest path is None for asset: {}", friendly);
}
}
}
}, },
None => { None => {
let _ = fs::create_dir(dest_path); let _ = fs::create_dir(dest_path);