1
Fork 0

Fail parsing frontmatter without panicking.

This commit is contained in:
Bauke 2023-01-08 12:43:58 +01:00
parent cf28b65d16
commit ce8be9e120
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 7 additions and 1 deletions

View File

@ -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::<VideoData>(&file_contents).unwrap();
match toml_frontmatter::parse::<VideoData>(&file_contents) {
Ok(parsed) => parsed,
Err(error) => {
println!("{error}");
continue;
}
};
data.push((video_data, markdown.to_string()));
}
}