X-Git-Url: https://git.r.bdr.sh/rbdr/page/blobdiff_plain/68fa37d61babe8d990ace5f9cb5a7de81eb57ea0..7348f5ea3a1182c9f4a75d05a405e90f9e33797c:/src/file_handler/mod.rs diff --git a/src/file_handler/mod.rs b/src/file_handler/mod.rs index a106c27..4932ef1 100644 --- a/src/file_handler/mod.rs +++ b/src/file_handler/mod.rs @@ -35,18 +35,18 @@ impl FileHandler { FileType::Unknown } - pub fn get_layout_or_panic(&mut self, files: &Vec) { + pub fn get_layout_or_panic(&mut self, files: &Vec) -> Result<(), &str> { for file in files { match file.file_type { FileType::Layout => { let layout_text = read_to_string(&file.path).unwrap(); self.layout = Some(layout_text); - return; + return Ok(()); }, _ => {} } } - panic!("No layout found. Please ensure there's a _layout.html file at the root"); + Err("No layout found. Please ensure there's a _layout.html file at the root") } pub fn handle_all(&self, source: &PathBuf, destination: &PathBuf, files: &Vec) {