Indicate which file is failing to render on error

This commit is contained in:
Vincent Prouillet 2018-05-17 18:32:31 +02:00
parent da3b0fcf0e
commit 860d1f4d1f
2 changed files with 5 additions and 3 deletions

View file

@ -172,13 +172,14 @@ impl Page {
let res = render_content(
&self.raw_content.replacen("<!-- more -->", "<a name=\"continue-reading\"></a>", 1),
&context
)?;
).chain_err(|| format!("Failed to render content of {}", self.file.path.display()))?;
self.content = res.0;
self.toc = res.1;
if self.raw_content.contains("<!-- more -->") {
self.summary = Some({
let summary = self.raw_content.splitn(2, "<!-- more -->").collect::<Vec<&str>>()[0];
render_content(summary, &context)?.0
render_content(summary, &context)
.chain_err(|| format!("Failed to render content of {}", self.file.path.display()))?.0
})
}

View file

@ -105,7 +105,8 @@ impl Section {
permalinks,
self.meta.insert_anchor_links,
);
let res = render_content(&self.raw_content, &context)?;
let res = render_content(&self.raw_content, &context)
.chain_err(|| format!("Failed to render content of {}", self.file.path.display()))?;
self.content = res.0;
self.toc = res.1;
Ok(())