Skip to content

Commit

Permalink
feat: show template path and name in error
Browse files Browse the repository at this point in the history
  • Loading branch information
InioX committed Dec 20, 2023
1 parent ca7f886 commit fd262c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/util/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl Template {

info!("Loaded <b><cyan>{}</> 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 {
Expand Down Expand Up @@ -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 {}",
Expand Down

0 comments on commit fd262c1

Please sign in to comment.