forked from lix-project/lix
Add traces to errors while updating flake lock file
Example: $ nix build --show-trace error: unable to download 'https://api.github.com/repos/NixOS/nixpkgs/commits/no-such-branch': HTTP error 422 ('') response body: { "message": "No commit found for SHA: no-such-branch", "documentation_url": "https://docs.github.com/rest/reference/repos#get-a-commit" } … while fetching the input 'github:NixOS/nixpkgs/no-such-branch' … while updating the flake input 'nixpkgs' … while updating the lock file of flake 'git+file:///home/eelco/Dev/nix'
This commit is contained in:
parent
8e758d402b
commit
c03f41055d
|
@ -298,6 +298,8 @@ LockedFlake lockFlake(
|
||||||
|
|
||||||
auto flake = getFlake(state, topRef, lockFlags.useRegistries, flakeCache);
|
auto flake = getFlake(state, topRef, lockFlags.useRegistries, flakeCache);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
// FIXME: symlink attack
|
// FIXME: symlink attack
|
||||||
auto oldLockFile = LockFile::read(
|
auto oldLockFile = LockFile::read(
|
||||||
flake.sourceInfo->actualPath + "/" + flake.lockedRef.subdir + "/flake.lock");
|
flake.sourceInfo->actualPath + "/" + flake.lockedRef.subdir + "/flake.lock");
|
||||||
|
@ -351,6 +353,8 @@ LockedFlake lockFlake(
|
||||||
auto inputPathS = printInputPath(inputPath);
|
auto inputPathS = printInputPath(inputPath);
|
||||||
debug("computing input '%s'", inputPathS);
|
debug("computing input '%s'", inputPathS);
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
/* Do we have an override for this input from one of the
|
/* Do we have an override for this input from one of the
|
||||||
ancestors? */
|
ancestors? */
|
||||||
auto i = overrides.find(inputPath);
|
auto i = overrides.find(inputPath);
|
||||||
|
@ -490,6 +494,11 @@ LockedFlake lockFlake(
|
||||||
std::make_shared<LockedNode>(lockedRef, *input.ref, false));
|
std::make_shared<LockedNode>(lockedRef, *input.ref, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (Error & e) {
|
||||||
|
e.addTrace({}, "while updating the flake input '%s'", inputPathS);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -576,6 +585,11 @@ LockedFlake lockFlake(
|
||||||
}
|
}
|
||||||
|
|
||||||
return LockedFlake { .flake = std::move(flake), .lockFile = std::move(newLockFile) };
|
return LockedFlake { .flake = std::move(flake), .lockFile = std::move(newLockFile) };
|
||||||
|
|
||||||
|
} catch (Error & e) {
|
||||||
|
e.addTrace({}, "while updating the lock file of flake '%s'", flake.lockedRef.to_string());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void callFlake(EvalState & state,
|
void callFlake(EvalState & state,
|
||||||
|
|
|
@ -132,7 +132,14 @@ std::pair<Tree, Input> Input::fetch(ref<Store> store) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto [tree, input] = scheme->fetch(store, *this);
|
auto [tree, input] = [&]() -> std::pair<Tree, Input> {
|
||||||
|
try {
|
||||||
|
return scheme->fetch(store, *this);
|
||||||
|
} catch (Error & e) {
|
||||||
|
e.addTrace({}, "while fetching the input '%s'", to_string());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
if (tree.actualPath == "")
|
if (tree.actualPath == "")
|
||||||
tree.actualPath = store->toRealPath(tree.storePath);
|
tree.actualPath = store->toRealPath(tree.storePath);
|
||||||
|
|
Loading…
Reference in a new issue