From fd262c1f8d328fab7db833040397b30c23a37100 Mon Sep 17 00:00:00 2001 From: InioX Date: Wed, 20 Dec 2023 21:05:30 +0100 Subject: [PATCH] feat: show template path and name in error --- src/util/template.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/template.rs b/src/util/template.rs index 10b9191..60a8316 100644 --- a/src/util/template.rs +++ b/src/util/template.rs @@ -158,7 +158,7 @@ impl Template { info!("Loaded {} templates.", &templates.len()); - let syntax = Syntax::builder().expr("{{", "}}").block("<[", "]>").build(); + let syntax = Syntax::builder().expr("{{", "}}").block("<*", "*>").build(); let mut engine = Engine::with_syntax(syntax); let image = match &source { @@ -189,7 +189,10 @@ impl Template { .wrap_err(format!("Could not read the {} template.", name)) .suggestion("Try converting the file to use UTF-8 encoding.")?; - engine.add_template(name, data)?; + engine.add_template(name, data).map_err(|error| { + let message = format!("[{} - {}]\n{:#}", name, input_path_absolute.display(), error); + Report::new(error).wrap_err(message).suggestion("Make sure you closed the {{ opening properly.") + })?; debug!( "Trying to write the {} template to {}",