libstore/store-api: offer more information about drv parsing errors
We offer the three usual options: verify, repair then delete and direct people to report us corruption so we can fix if this is induced by us. Fixes #447. Change-Id: I0df61769d732d227333c206f312857c0593f7bce Signed-off-by: Raito Bezarius <raito@lix.systems>
This commit is contained in:
@@ -1338,7 +1338,19 @@ try {
|
||||
Derivation::nameFromPath(drvPath)
|
||||
);
|
||||
} catch (FormatError & e) {
|
||||
throw Error("error parsing derivation '%s': %s", store.printStorePath(drvPath), e.msg());
|
||||
auto drvPathS = store.printStorePath(drvPath);
|
||||
throw Error(
|
||||
fmt("error parsing derivation '%1%': %2%\n"
|
||||
"This can occur when the derivation is corrupted.\n"
|
||||
"You can check this with `nix-store --verify-path %1%` and possibly repair with "
|
||||
"`nix-store --repair-path %1%`.\n"
|
||||
"In case the repair cannot be done, `nix-store --delete %1%` may be able "
|
||||
"to remove the broken path.\n"
|
||||
"We would appreciate a bug report at "
|
||||
"https://git.lix.systems/lix-project/lix/issues if you think this is a bug.",
|
||||
drvPathS,
|
||||
e.msg())
|
||||
);
|
||||
}
|
||||
} catch (...) {
|
||||
co_return result::current_exception();
|
||||
|
||||
Reference in New Issue
Block a user