diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index f95754599..d2636abf7 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -948,7 +948,8 @@ static void queryJSON(Globals & globals, vector & elems, bool printOutP } catch (AssertionError & e) { printMsg(lvlTalkative, "skipping derivation named '%1%' which gives an assertion failure", i.queryName()); } catch (Error & e) { - printMsg(lvlError, "skipping derivation named '%1%' which gives an error '%2%'", i.queryName(), e.msg()); + e.addTrace(std::nullopt, "while querying the derivation named '%1%'", i.queryName()); + throw; } } }