aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-04-08 14:20:58 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-04-08 14:20:58 +0200
commit6b0ca8e803710342af70e257935724c5ad84ca04 (patch)
tree0b48ecdd5b08ba119a94131f9bf11c9612dfa1e5
parentc101b29133200442de05275c725c8d77aa888b27 (diff)
findAlongAttrPath(): Throw AttrPathNotFound
-rw-r--r--src/libexpr/attr-path.cc4
-rw-r--r--src/libexpr/attr-path.hh2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc
index b0f80db32..832235cfd 100644
--- a/src/libexpr/attr-path.cc
+++ b/src/libexpr/attr-path.cc
@@ -70,7 +70,7 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath,
Bindings::iterator a = v->attrs->find(state.symbols.create(attr));
if (a == v->attrs->end())
- throw Error(format("attribute '%1%' in selection path '%2%' not found") % attr % attrPath);
+ throw AttrPathNotFound("attribute '%1%' in selection path '%2%' not found", attr, attrPath);
v = &*a->value;
}
@@ -82,7 +82,7 @@ Value * findAlongAttrPath(EvalState & state, const string & attrPath,
% attrPath % showType(*v));
if (attrIndex >= v->listSize())
- throw Error(format("list index %1% in selection path '%2%' is out of range") % attrIndex % attrPath);
+ throw AttrPathNotFound("list index %1% in selection path '%2%' is out of range", attrIndex, attrPath);
v = v->listElems()[attrIndex];
}
diff --git a/src/libexpr/attr-path.hh b/src/libexpr/attr-path.hh
index 46a341950..1eae64625 100644
--- a/src/libexpr/attr-path.hh
+++ b/src/libexpr/attr-path.hh
@@ -7,6 +7,8 @@
namespace nix {
+MakeError(AttrPathNotFound, Error);
+
Value * findAlongAttrPath(EvalState & state, const string & attrPath,
Bindings & autoArgs, Value & vIn);