diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-01-25 12:50:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-25 12:50:57 +0100 |
commit | 488a826842296c9c2933fb53cc884ed8518f9110 (patch) | |
tree | 5ab9dd63a9609ddaec8f5ba136b78ffd6eef734c /src/nix-env | |
parent | c5b42c5a42138329c6d02da0d8a53cb59c6077f4 (diff) | |
parent | 0eb22db3116585821096b7b81295d4bbf5550343 (diff) |
Merge pull request #4467 from edolstra/error-formatting
Improve error formatting
Diffstat (limited to 'src/nix-env')
-rw-r--r-- | src/nix-env/nix-env.cc | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 9963f05d9..d6a16999f 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -124,10 +124,7 @@ static void getAllExprs(EvalState & state, if (hasSuffix(attrName, ".nix")) attrName = string(attrName, 0, attrName.size() - 4); if (!attrs.insert(attrName).second) { - logError({ - .name = "Name collision", - .hint = hintfmt("warning: name collision in input Nix expressions, skipping '%1%'", path2) - }); + printError("warning: name collision in input Nix expressions, skipping '%1%'", path2); continue; } /* Load the expression on demand. */ @@ -876,11 +873,7 @@ static void queryJSON(Globals & globals, vector<DrvInfo> & elems) auto placeholder = metaObj.placeholder(j); Value * v = i.queryMeta(j); if (!v) { - logError({ - .name = "Invalid meta attribute", - .hint = hintfmt("derivation '%s' has invalid meta attribute '%s'", - i.queryName(), j) - }); + printError("derivation '%s' has invalid meta attribute '%s'", i.queryName(), j); placeholder.write(nullptr); } else { PathSet context; @@ -1131,12 +1124,9 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs) attrs2["name"] = j; Value * v = i.queryMeta(j); if (!v) - logError({ - .name = "Invalid meta attribute", - .hint = hintfmt( - "derivation '%s' has invalid meta attribute '%s'", - i.queryName(), j) - }); + printError( + "derivation '%s' has invalid meta attribute '%s'", + i.queryName(), j); else { if (v->type() == nString) { attrs2["type"] = "string"; |