diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-05-08 18:18:28 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-05-08 18:18:28 -0600 |
commit | 55eb71714854b262b5e1079ff250a13cc0bbf644 (patch) | |
tree | 576767e919ac461b15ce11671a285d3933e15129 /src/libexpr/parser.y | |
parent | 1b801cec407454b904466153dfc56cec6b433f4b (diff) |
add pos to errorinfo, remove from hints
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r-- | src/libexpr/parser.y | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 3ed9a7a4f..a3ad54a3d 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -404,7 +404,12 @@ expr_simple | URI { static bool noURLLiterals = settings.isExperimentalFeatureEnabled("no-url-literals"); if (noURLLiterals) - throw ParseError("URL literals are disabled, at %s", CUR_POS); + throw ParseError( + ErrorInfo { + .hint = hintfmt("URL literals are disabled"), + .nixCode = NixCode { .errPos = CUR_POS } + }); + $$ = new ExprString(data->symbols.create($1)); } | '(' expr ')' { $$ = $2; } @@ -669,10 +674,12 @@ Path EvalState::findFile(SearchPath & searchPath, const string & path, const Pos Path res = r.second + suffix; if (pathExists(res)) return canonPath(res); } - string f = - "file '%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)" - + string(pos ? ", at %2%" : ""); - throw ThrownError(f, path, pos); + + throw ThrownError( + ErrorInfo { + .hint = hintfmt("file '%1%' was not found in the Nix search path (add it using $NIX_PATH or -I)", path), + .nixCode = NixCode { .errPos = pos } + }); } |