aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-02 23:04:36 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-03 17:14:40 +0100
commit76d8bdfe355aa1976580f4fa8f11f1ec505a6c66 (patch)
tree484504f0a2819a7cad02da783587fd9110911ea1
parent0e05cb6c619afca77f0162d8f2cc62d6618500de (diff)
Include note about type of catched errors in tryEval documentation
Reference #356.
-rw-r--r--src/libexpr/primops.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 13565b950..1d1afa768 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -696,10 +696,14 @@ static RegisterPrimOp primop_tryEval({
Try to shallowly evaluate *e*. Return a set containing the
attributes `success` (`true` if *e* evaluated successfully,
`false` if an error was thrown) and `value`, equalling *e* if
- successful and `false` otherwise. Note that this doesn't evaluate
- *e* deeply, so ` let e = { x = throw ""; }; in (builtins.tryEval
- e).success ` will be `true`. Using ` builtins.deepSeq ` one can
- get the expected result: `let e = { x = throw ""; }; in
+ successful and `false` otherwise. `tryEval` will only prevent
+ errors created by `throw` or `assert` from being thrown.
+ Errors `tryEval` will not catch are for example those created
+ by `abort` and type errors generated by builtins. Also note that
+ this doesn't evaluate *e* deeply, so `let e = { x = throw ""; };
+ in (builtins.tryEval e).success` will be `true`. Using
+ `builtins.deepSeq` one can get the expected result:
+ `let e = { x = throw ""; }; in
(builtins.tryEval (builtins.deepSeq e e)).success` will be
`false`.
)",