-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
tryEval: catch all EvalError exceptions #5564
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
|
Independent of this change, maybe another builtin with more fine grained control would be a good idea? |
Another possible solution for this which has been proposed in some other issue is to return the error itself inside the return value. But this should probably be discussed elsewhere. |
|
No, we shouldn't do this. In particular, aborts should not be caught. The whole point of |
|
|
Thanks for clarification. Closing |
|
how could I customise error message thrown by |
|
Something like this would still be useful, however, for Nix tooling. |
Aside from
throwandassert, tryEval will now also catch other eval errors like type errors, abort and JSON parse errors.This gives the user the capability to write code that is able to recover from common evaluation errors.
Examples:
lib.toIntwas not recoverable as this is also based on json parsing.fixes #5455
related: #356