Update json5 crate to include location errors

This commit is contained in:
2021-02-12 18:08:10 +01:00
parent d11abff1c3
commit 78f0c9ed2c
2 changed files with 16 additions and 3 deletions

View File

@@ -197,7 +197,20 @@ fn main() {
let opt = Options::from_args();
let filecontents = std::fs::read_to_string(&opt.json).unwrap();
let config: parsing::Configuration = json5::from_str(&filecontents).unwrap();
let config: parsing::Configuration = match json5::from_str(&filecontents) {
Ok(config) => config,
Err(e) => {
eprintln!("Configuration could not be read: {}", e);
if let json5::Error::Message {
location: Some(location),
..
} = e
{
eprintln!("\t{:?}", location);
}
return;
}
};
let parsing::RuntimeConfiguration {
names,