From 860d1f4d1f0ba8604e5b8bb372b8c3b5197f68e9 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Thu, 17 May 2018 18:32:31 +0200 Subject: [PATCH] Indicate which file is failing to render on error --- components/content/src/page.rs | 5 +++-- components/content/src/section.rs | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/content/src/page.rs b/components/content/src/page.rs index f977c464..d2f940d7 100644 --- a/components/content/src/page.rs +++ b/components/content/src/page.rs @@ -172,13 +172,14 @@ impl Page { let res = render_content( &self.raw_content.replacen("", "", 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("") { self.summary = Some({ let summary = self.raw_content.splitn(2, "").collect::>()[0]; - render_content(summary, &context)?.0 + render_content(summary, &context) + .chain_err(|| format!("Failed to render content of {}", self.file.path.display()))?.0 }) } diff --git a/components/content/src/section.rs b/components/content/src/section.rs index c864318e..550acf76 100644 --- a/components/content/src/section.rs +++ b/components/content/src/section.rs @@ -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(())