Skip to content

Commit

Permalink
feat: add span of file in template render error
Browse files Browse the repository at this point in the history
  • Loading branch information
InioX committed Dec 12, 2023
1 parent 52dc36f commit 2a706cf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/util/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use color_eyre::eyre::ContextCompat;
use color_eyre::eyre::WrapErr;
use color_eyre::Help;
use color_eyre::{eyre::Result, Report};
use color_eyre::SectionExt;

use colorsys::Hsl;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -211,10 +212,11 @@ impl Template {
));
}

data = engine.template(name)
.render(upon::value!{ colors: &colors, image: image, custom: &custom, })
.to_string()?;

let data = engine.template(name).render(upon::value!{ colors: &colors, image: image, custom: &custom, }).to_string().map_err(|error| {
let message = format!("{:#}", error);
Report::new(error).wrap_err(message)
})?;

let mut output_file = OpenOptions::new()
.create(true)
.truncate(true)
Expand Down

0 comments on commit 2a706cf

Please sign in to comment.