Update json5 crate to include location errors
This commit is contained in:
parent
d11abff1c3
commit
78f0c9ed2c
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sbp = { path = "../sbp", features = ["rayon", "serde1"] }
|
sbp = { path = "../sbp", features = ["rayon", "serde1", "fast-float"] }
|
||||||
euler = { path = "../euler", features = ["serde1"] }
|
euler = { path = "../euler", features = ["serde1"] }
|
||||||
hdf5 = "0.7.0"
|
hdf5 = "0.7.0"
|
||||||
rayon = "1.3.0"
|
rayon = "1.3.0"
|
||||||
|
@ -14,5 +14,5 @@ indicatif = "0.15.0"
|
||||||
structopt = "0.3.14"
|
structopt = "0.3.14"
|
||||||
ndarray = { version = "0.13.1", features = ["serde"] }
|
ndarray = { version = "0.13.1", features = ["serde"] }
|
||||||
serde = { version = "1.0.115", features = ["derive"] }
|
serde = { version = "1.0.115", features = ["derive"] }
|
||||||
json5 = "0.2.8"
|
json5 = "0.3.0"
|
||||||
indexmap = { version = "1.5.2", features = ["serde-1"] }
|
indexmap = { version = "1.5.2", features = ["serde-1"] }
|
||||||
|
|
|
@ -197,7 +197,20 @@ fn main() {
|
||||||
let opt = Options::from_args();
|
let opt = Options::from_args();
|
||||||
let filecontents = std::fs::read_to_string(&opt.json).unwrap();
|
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 {
|
let parsing::RuntimeConfiguration {
|
||||||
names,
|
names,
|
||||||
|
|
Loading…
Reference in New Issue