mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
make-initrd-ng: also print json itself if it fails to parse
The current error message is hard to debug because the error is in the nix store: > Error: failed to parse JSON in "/build/.attr-1s42g1c76fxb77skzq0b4wdhcrg8jmzb54czmxvh1qm7psgsbcni" > > Caused by: > missing field `source` at line 1 column 102 > > Location: > src/main.rs:329:10
This commit is contained in:
parent
1318ddf6f3
commit
3de4714572
@ -326,7 +326,12 @@ fn main() -> eyre::Result<()> {
|
|||||||
let contents =
|
let contents =
|
||||||
fs::read(&args[1]).wrap_err_with(|| format!("failed to open file {:?}", &args[1]))?;
|
fs::read(&args[1]).wrap_err_with(|| format!("failed to open file {:?}", &args[1]))?;
|
||||||
let input = serde_json::from_slice::<Vec<StoreInput>>(&contents)
|
let input = serde_json::from_slice::<Vec<StoreInput>>(&contents)
|
||||||
.wrap_err_with(|| format!("failed to parse JSON in {:?}", &args[1]))?;
|
.wrap_err_with(|| {
|
||||||
|
let text = String::from_utf8_lossy(&contents);
|
||||||
|
format!("failed to parse JSON '{}' in {:?}",
|
||||||
|
text,
|
||||||
|
&args[1])
|
||||||
|
})?;
|
||||||
let output = &args[2];
|
let output = &args[2];
|
||||||
let out_path = Path::new(output);
|
let out_path = Path::new(output);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user