minor refactor

This commit is contained in:
Valerie Wolfe 2024-07-09 09:55:35 -04:00
parent cdc0c02e37
commit 92a201981a

View file

@ -92,8 +92,7 @@ pub fn build(targets: &Vec<Map<String, Value>>, template_dir: String, config: &C
let content = read_to_string(path).unwrap();
let template = engine.compile(&content);
if template.is_err() {
let error = template.err().unwrap();
if let Err(error) = template {
println!(" {BOLD}{FAILURE}failed to compile template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}");
continue;
}
@ -101,8 +100,7 @@ pub fn build(targets: &Vec<Map<String, Value>>, template_dir: String, config: &C
// render
println!(" {ITALIC}rendering{RESET}");
let render = template.unwrap().render(&context).to_string();
if render.is_err() {
let error = render.err().unwrap();
if let Err(error) = render {
println!(" {BOLD}{FAILURE}failed to render template:{RESET}\n {FAILURE}{error}\n {BOLD}skipping{RESET}");
continue;
}