mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
doc: Explain why tryEval does not return the message
(cherry picked from commit 90d257b771
)
This commit is contained in:
parent
e0c8b0fc4f
commit
9c54fac5ff
1 changed files with 3 additions and 0 deletions
|
@ -939,6 +939,9 @@ static RegisterPrimOp primop_tryEval({
|
|||
`let e = { x = throw ""; }; in
|
||||
(builtins.tryEval (builtins.deepSeq e e)).success` will be
|
||||
`false`.
|
||||
|
||||
`tryEval` intentionally does not return the error message, because that risks bringing non-determinism into the evaluation result, and it would become very difficult to improve error reporting without breaking existing expressions.
|
||||
Instead, use [`builtins.addErrorContext`](@docroot@/language/builtins.md#builtins-addErrorContext) to add context to the error message, and use a Nix unit testing tool for testing.
|
||||
)",
|
||||
.fun = prim_tryEval,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue