Skip to content

Commit

Permalink
Updated error handling
Browse files Browse the repository at this point in the history
Now can identify which profile is malformed.
  • Loading branch information
jalexvig committed Jun 28, 2018
1 parent c1bfd54 commit 1fba3f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn load_profs(fnames: Vec<String>, dpath: &std::path::PathBuf) -> HashMap<String
let file =
fs::File::open(fpath_prof).expect(&format!("could not open profile: {}", &fname));

let json: Value = serde_json::from_reader(file).expect("error reading json file");
let json: Value = serde_json::from_reader(file).expect(&format!("error reading profile {}", &fname));

// using entry pattern: https://stackoverflow.com/questions/30851464
if let Value::Object(m) = json {
Expand Down Expand Up @@ -149,7 +149,7 @@ fn c3_linearize(fname: String, dpath: &std::path::PathBuf) -> Vec<String> {

let file = fs::File::open(fpath).expect(&format!("could not open profile: {}", fname));

let json: Value = serde_json::from_reader(file).expect("error reading json file");
let json: Value = serde_json::from_reader(file).expect(&format!("error reading profile {}", &fname));

let parents: Vec<String> = match &json["inherits"] {
&Value::Null => {
Expand Down

0 comments on commit 1fba3f4

Please sign in to comment.