From 110a9ef105910d489a477698529f5a3083e73524 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Tue, 9 Sep 2025 12:11:50 +0200 Subject: [PATCH] Add rl-next/c-api-recoverable-errors --- .../rl-next/c-api-recoverable-errors.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 doc/manual/rl-next/c-api-recoverable-errors.md diff --git a/doc/manual/rl-next/c-api-recoverable-errors.md b/doc/manual/rl-next/c-api-recoverable-errors.md new file mode 100644 index 000000000..0549ed426 --- /dev/null +++ b/doc/manual/rl-next/c-api-recoverable-errors.md @@ -0,0 +1,23 @@ +--- +synopsis: "C API: Errors returned from your primops are not treated as recoverable by default" +prs: [13930] +--- + +Nix 2.32 by default remembers the error in the thunk that triggered it. + +Previously the following sequence of events worked: + +1. Have a thunk that invokes a primop that's defined through the C API +2. The primop returns an error +3. Force the thunk again +4. The primop returns a value +5. The thunk evaluated successfully + +**Resolution** + +C API consumers that rely on this must change their recoverable error calls: + +```diff +-nix_set_err_msg(context, NIX_ERR_*, msg); ++nix_set_err_msg(context, NIX_ERR_RECOVERABLE, msg); +```