Error on invalid file/section

This commit is contained in:
Vincent Prouillet 2021-03-06 23:00:56 +01:00
parent 67f9b9499b
commit 25ef603990

View file

@ -243,17 +243,11 @@ impl Site {
.collect::<Vec<DirEntry>>(); .collect::<Vec<DirEntry>>();
for index_file in index_files { for index_file in index_files {
let section = match Section::from_file( let section = Section::from_file(
index_file.path(), index_file.path(),
&self.config, &self.config,
&self.base_path, &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 the section is drafted we can skip the enitre dir
if section.meta.draft && !self.include_drafts { if section.meta.draft && !self.include_drafts {
@ -264,13 +258,7 @@ impl Site {
self.add_section(section, false)?; self.add_section(section, false)?;
} }
} else { } else {
let page = match Page::from_file(path, &self.config, &self.base_path) { let page = Page::from_file(path, &self.config, &self.base_path)?;
Err(e) => {
println!("Failed to load page: {:?}", e);
continue;
}
Ok(p) => p,
};
// should we skip drafts? // should we skip drafts?
if page.meta.draft && !self.include_drafts { if page.meta.draft && !self.include_drafts {