Skip to content

Commit 3fdd2ef

Browse files
committed
front_matter: improve error messages
1 parent 284ef6a commit 3fdd2ef

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

front_matter/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ mod tests {
175175
.contains("content/inside-rust/");
176176

177177
let content = fs::read_to_string(&post).unwrap();
178-
let (front_matter, rest) = parse(&content).unwrap();
178+
let (front_matter, rest) = parse(&content).unwrap_or_else(|err| {
179+
panic!("failed to parse {:?}: {err}", post.display());
180+
});
179181
let normalized = normalize(&front_matter, slug, inside_rust).unwrap_or_else(|err| {
180-
panic!("failed to normalize {:?}: {err}", post.file_name().unwrap());
182+
panic!("failed to normalize {:?}: {err}", post.display());
181183
});
182184

183185
if front_matter != normalized {

0 commit comments

Comments
 (0)