Catch and log header parse errors

This commit is contained in:
mars 2024-02-10 17:22:13 -07:00
parent a144735fdb
commit 07e8fbad93
1 changed files with 9 additions and 1 deletions

View File

@ -57,7 +57,15 @@ fn main() {
let path = entry.path();
let f = File::open(path).unwrap();
let mut read = BufReader::new(f);
let lines = parse::Language::RUST.read_header(&mut read).unwrap();
let lines = match parse::Language::RUST.read_header(&mut read) {
Ok(lines) => lines,
Err(err) => {
eprintln!("error parsing {:?}: {:?}", path, err);
continue;
}
};
let header = parse::Header::parse(lines).unwrap();
println!("{:?}: {:#?}", path, header);