1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 06:01:48 +02:00

Merge pull request #12191 from NixOS/mergify/bp/2.24-maintenance/pr-11723

doc: Explain why tryEval does not return the message (backport #11723)
This commit is contained in:
mergify[bot] 2025-01-10 19:34:59 +00:00 committed by GitHub
commit d3cb938e07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,
});