aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops/context.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-06-15 14:06:58 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-06-15 14:06:58 +0200
commit1fb762d11fadc659ef41b79eaddddcce5fbbc192 (patch)
treee47612705a9af354ab5bdca7864d70b1158ace12 /src/libexpr/primops/context.cc
parentfd64e4fb96f814440dc337ce664cdbd22e0eabb2 (diff)
Get rid of explicit ErrorInfo constructors
Diffstat (limited to 'src/libexpr/primops/context.cc')
-rw-r--r--src/libexpr/primops/context.cc27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/libexpr/primops/context.cc b/src/libexpr/primops/context.cc
index 7f895fc01..efa2e9576 100644
--- a/src/libexpr/primops/context.cc
+++ b/src/libexpr/primops/context.cc
@@ -146,11 +146,10 @@ static void prim_appendContext(EvalState & state, const Pos & pos, Value * * arg
auto sAllOutputs = state.symbols.create("allOutputs");
for (auto & i : *args[1]->attrs) {
if (!state.store->isStorePath(i.name))
- throw EvalError(
- ErrorInfo {
- .hint = hintfmt("Context key '%s' is not a store path", i.name),
- .nixCode = NixCode { .errPos = *i.pos }
- });
+ throw EvalError({
+ .hint = hintfmt("Context key '%s' is not a store path", i.name),
+ .nixCode = NixCode { .errPos = *i.pos }
+ });
if (!settings.readOnlyMode)
state.store->ensurePath(state.store->parseStorePath(i.name));
state.forceAttrs(*i.value, *i.pos);
@@ -164,11 +163,10 @@ static void prim_appendContext(EvalState & state, const Pos & pos, Value * * arg
if (iter != i.value->attrs->end()) {
if (state.forceBool(*iter->value, *iter->pos)) {
if (!isDerivation(i.name)) {
- throw EvalError(
- ErrorInfo {
- .hint = hintfmt("Tried to add all-outputs context of %s, which is not a derivation, to a string", i.name),
- .nixCode = NixCode { .errPos = *i.pos }
- });
+ throw EvalError({
+ .hint = hintfmt("Tried to add all-outputs context of %s, which is not a derivation, to a string", i.name),
+ .nixCode = NixCode { .errPos = *i.pos }
+ });
}
context.insert("=" + string(i.name));
}
@@ -178,11 +176,10 @@ static void prim_appendContext(EvalState & state, const Pos & pos, Value * * arg
if (iter != i.value->attrs->end()) {
state.forceList(*iter->value, *iter->pos);
if (iter->value->listSize() && !isDerivation(i.name)) {
- throw EvalError(
- ErrorInfo {
- .hint = hintfmt("Tried to add derivation output context of %s, which is not a derivation, to a string", i.name),
- .nixCode = NixCode { .errPos = *i.pos }
- });
+ throw EvalError({
+ .hint = hintfmt("Tried to add derivation output context of %s, which is not a derivation, to a string", i.name),
+ .nixCode = NixCode { .errPos = *i.pos }
+ });
}
for (unsigned int n = 0; n < iter->value->listSize(); ++n) {
auto name = state.forceStringNoCtx(*iter->value->listElems()[n], *iter->pos);