-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
2259 error message - "auto-call" error #4240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think very long error messages should be avoided since then we just end up duplicating the manual. The error message can also get out of date, for instance it talks about It's probably better to have a shorter message that links to the manual for more information (not Nix pills which are not an authoritative reference for Nix). |
src/libexpr/eval.cc
Outdated
throwTypeError("cannot auto-call a function that has an argument without a default value ('%1%')", i.name); | ||
throwUndefinedVarError(i.pos, R"(cannot auto-call a function that has an argument without a default value ('%1%') | ||
|
||
An 'auto-call' is when a nix expression is evaluated without any external arguments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. An auto-call is when a top-level function is called with external arguments or with default values if no matching argument is provided.
It's probably better to say something like `you need to pass "--arg %1% ...' or '--argstr %1% ...'".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UndefinedVarError
is probably misleading. There is no undefined variable, just a missing argument.
Thanks for the merge! |
The PR #4240 changed messag of the error that was thrown when an auto-called function was missing an argument. However this change also changed the type of the error, from `EvalError` to a new `MissingArgumentError`. This broke hydra which was relying on an `EvalError` being thrown. Make `MissingArgumentError` a subclass of `EvalError` to un-break hydra.
revised this "auto-call" error which I've found to be somewhat inscrutable in the past. This is intended to address (in part) issue #2259.
Current output is like this:
Revised error output is like so:
This reflect my perhaps imperfect understanding of autoCall, feedback on that is welcome.