From 25ef603990f2d7456f247d2fe55f70211df0a833 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Sat, 6 Mar 2021 23:00:56 +0100 Subject: [PATCH] Error on invalid file/section --- components/site/src/lib.rs | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index bf15f75f..97704778 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -243,17 +243,11 @@ impl Site { .collect::>(); for index_file in index_files { - let section = match Section::from_file( + let section = Section::from_file( index_file.path(), &self.config, &self.base_path, - ) { - Err(e) => { - println!("Failed to load section: {:?}", e); - continue; - } - Ok(sec) => sec, - }; + )?; // if the section is drafted we can skip the enitre dir if section.meta.draft && !self.include_drafts { @@ -264,13 +258,7 @@ impl Site { self.add_section(section, false)?; } } else { - let page = match Page::from_file(path, &self.config, &self.base_path) { - Err(e) => { - println!("Failed to load page: {:?}", e); - continue; - } - Ok(p) => p, - }; + let page = Page::from_file(path, &self.config, &self.base_path)?; // should we skip drafts? if page.meta.draft && !self.include_drafts {