diff --git a/src/operation.rs b/src/operation.rs index e267627..ecd1e84 100644 --- a/src/operation.rs +++ b/src/operation.rs @@ -92,8 +92,7 @@ pub fn build(targets: &Vec>, 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>, 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; }