From ce8be9e12059af553ecf8a2ea49b95b4adc2b647 Mon Sep 17 00:00:00 2001 From: Bauke Date: Sun, 8 Jan 2023 12:43:58 +0100 Subject: [PATCH] Fail parsing frontmatter without panicking. --- source/video/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/video/mod.rs b/source/video/mod.rs index 1fc378b..10e0874 100644 --- a/source/video/mod.rs +++ b/source/video/mod.rs @@ -41,7 +41,13 @@ pub fn write_all(public_dir: &Path) -> Result<()> { let file_contents = fs::read_to_string(file_path)?; let (video_data, markdown) = - toml_frontmatter::parse::(&file_contents).unwrap(); + match toml_frontmatter::parse::(&file_contents) { + Ok(parsed) => parsed, + Err(error) => { + println!("{error}"); + continue; + } + }; data.push((video_data, markdown.to_string())); } }