mirror of
https://github.com/NixOS/nix
synced 2025-06-25 14:51:16 +02:00
Treat undefined variable errors consistently
Previously, a undefined variable inside a "with" caused an EvalError (which can be caught), while outside, it caused a ParseError (which cannot be caught). Now both cause an UndefinedVarError (which cannot be caught).
This commit is contained in:
parent
6b47de580f
commit
b1e3b1a4ac
3 changed files with 8 additions and 2 deletions
|
@ -198,7 +198,7 @@ void ExprVar::bindVars(const StaticEnv & env)
|
|||
/* Otherwise, the variable must be obtained from the nearest
|
||||
enclosing `with'. If there is no `with', then we can issue an
|
||||
"undefined variable" error now. */
|
||||
if (withLevel == -1) throw ParseError(format("undefined variable `%1%' at %2%") % name % pos);
|
||||
if (withLevel == -1) throw UndefinedVarError(format("undefined variable `%1%' at %2%") % name % pos);
|
||||
|
||||
fromWith = true;
|
||||
this->level = withLevel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue