mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
findAlongAttrPath(): Throw AttrPathNotFound
This commit is contained in:
parent
c101b29133
commit
6b0ca8e803
2 changed files with 4 additions and 2 deletions
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
MakeError(AttrPathNotFound, Error);
|
||||
|
||||
Value * findAlongAttrPath(EvalState & state, const string & attrPath,
|
||||
Bindings & autoArgs, Value & vIn);
|
||||
|
||||
|
|
Loading…
Reference in a new issue