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

New CLI flag --replace-eval-errors

Co-authored-by: Farid Zakaria <farid.m.zakaria@gmail.com>
This commit is contained in:
Shahar "Dawn" Or 2025-05-12 18:44:07 +07:00
parent cdbe788c1f
commit 88705f848b
14 changed files with 93 additions and 20 deletions

View file

@ -112,6 +112,11 @@ standard input.
When used with `--eval`, print the resulting value as an JSON
representation of the abstract syntax tree rather than as a Nix expression.
- `--replace-eval-errors`
When used with `--eval` and `--json`, replace any evaluation errors with the string
`"«evaluation error»"`.
- `--xml`
When used with `--eval`, print the resulting value as an XML
@ -205,3 +210,10 @@ $ nix-instantiate --eval --xml --strict --expr '{ x = {}; }'
</attrs>
</expr>
```
Replacing evaluation errors:
```console
$ nix-instantiate --eval --json --replace-eval-errors --expr '{ a = throw "fail"; }'
{"a":"«evaluation error»"}
```