Skip to content

Commit

Permalink
Include path to json deserialization error
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 13, 2024
1 parent b79fa4b commit fc2b820
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ clap = { version = "4", features = ["deprecated", "derive"] }
serde = "1.0.194"
serde_derive = "1.0.194"
serde_json = "1.0.110"
serde_path_to_error = "0.1"
toml = "0.8"
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ fn do_main() -> Result<()> {
process::exit(output.status.code().unwrap_or(1));
}

let metadata: Metadata = serde_json::from_slice(&output.stdout)
let mut json = serde_json::Deserializer::from_slice(&output.stdout);
let metadata: Metadata = serde_path_to_error::deserialize(&mut json)
.context("Failed to parse output of `cargo metadata`")?;

let mut packages = Map::new();
Expand Down

0 comments on commit fc2b820

Please sign in to comment.