1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 04:26:01 +01:00
nix/doc/manual/rl-next/c-api-recoverable-errors.md
2025-09-10 12:49:41 +02:00

639 B

synopsis prs
C API: Errors returned from your primops are not treated as recoverable by default
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:

-nix_set_err_msg(context, NIX_ERR_*, msg);
+nix_set_err_msg(context, NIX_ERR_RECOVERABLE, msg);