lix/tests/functional
eldritch horrors 08252967a8 libexpr: Support structured error classes
While preparing PRs like #9753, I've had to change error messages in
dozens of code paths. It would be nice if instead of

    EvalError("expected 'boolean' but found '%1%'", showType(v))

we could write

    TypeError(v, "boolean")

or similar. Then, changing the error message could be a mechanical
refactor with the compiler pointing out places the constructor needs to
be changed, rather than the error-prone process of grepping through the
codebase. Structured errors would also help prevent the "same" error
from having multiple slightly different messages, and could be a first
step towards error codes / an error index.

This PR reworks the exception infrastructure in `libexpr` to
support exception types with different constructor signatures than
`BaseError`. Actually refactoring the exceptions to use structured data
will come in a future PR (this one is big enough already, as it has to
touch every exception in `libexpr`).

The core design is in `eval-error.hh`. Generally, errors like this:

    state.error("'%s' is not a string", getAttrPathStr())
      .debugThrow<TypeError>()

are transformed like this:

    state.error<TypeError>("'%s' is not a string", getAttrPathStr())
      .debugThrow()

The type annotation has moved from `ErrorBuilder::debugThrow` to
`EvalState::error`.

(cherry picked from commit c6a89c1a1659b31694c0fbcd21d78a6dd521c732)
Change-Id: Iced91ba4e00ca9e801518071fb43798936cbd05a
2024-03-09 04:47:05 -07:00
..
ca
common
config
dyn-drv Merge pull request #9753 from 9999years/print-value-on-type-error 2024-03-09 00:05:41 -07:00
flakes Merge pull request #9324 from 9999years/fix-8854-take-2 2024-03-07 14:50:43 +01:00
lang libexpr: Support structured error classes 2024-03-09 04:47:05 -07:00
nested-sandboxing
plugins
test-libstoreconsumer
add.sh
bad.tar.xz
bash-profile.sh
big-derivation-attr.nix
binary-cache-build-remote.sh
binary-cache.sh
brotli.sh
build-delete.sh
build-dry.sh
build-hook-ca-fixed.nix
build-hook-ca-floating.nix Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
build-hook.nix
build-remote-content-addressed-fixed.sh
build-remote-content-addressed-floating.sh
build-remote-input-addressed.sh
build-remote-trustless-after.sh Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
build-remote-trustless-should-fail-0.sh Merge pull request #9529 from wh0/patch-1 2024-03-04 07:11:25 +01:00
build-remote-trustless-should-pass-0.sh
build-remote-trustless-should-pass-1.sh
build-remote-trustless-should-pass-2.sh
build-remote-trustless-should-pass-3.sh
build-remote-trustless.sh
build-remote.sh
build.sh
ca-shell.nix
case-hack.sh
case.nar
check-refs.nix Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
check-refs.sh
check-reqs.nix
check-reqs.sh
check.nix
check.sh
common.sh
completions.sh
compression-levels.sh
compute-levels.sh
config.nix.in
config.sh
db-migration.sh
debugger.sh
dependencies.builder0.sh
dependencies.nix
dependencies.sh
derivation-json.sh
dummy
dump-db.sh Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
eval-store.sh
eval.nix
eval.sh
experimental-features.sh Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
export-graph.nix
export-graph.sh
export.sh
failing.nix
fetchClosure.sh
fetchGit.sh
fetchGitRefs.sh
fetchGitSubmodules.sh
fetchMercurial.sh
fetchPath.sh
fetchTree-file.sh
fetchurl.sh
filter-source.nix Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
filter-source.sh
fixed.builder1.sh
fixed.builder2.sh Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
fixed.nix
fixed.sh
fmt.sh
fmt.simple.sh
function-trace.sh
gc-auto.sh
gc-concurrent.builder.sh
gc-concurrent.nix
gc-concurrent.sh
gc-concurrent2.builder.sh
gc-non-blocking.sh
gc-runtime.nix
gc-runtime.sh
gc.sh
hash-check.nix
hash.sh
hermetic.nix
ifd.nix
import-derivation.nix
import-derivation.sh
impure-derivations.nix
impure-derivations.sh
impure-eval.sh
init.sh
install-darwin.sh
lang-test-infra.sh
lang.sh
legacy-ssh-store.sh
linux-sandbox-cert-test.nix
linux-sandbox.sh
local-store.sh
local.mk Merge pull request #9324 from 9999years/fix-8854-take-2 2024-03-07 14:50:43 +01:00
logging.sh
misc.sh
multiple-outputs.nix
multiple-outputs.sh
nar-access.nix
nar-access.sh
nested-sandboxing.sh
nix-build-examples.nix
nix-build.sh
nix-channel.sh
nix-collect-garbage-d.sh
nix-copy-ssh-common.sh
nix-copy-ssh-ng.sh
nix-copy-ssh.sh
nix-daemon-untrusting.sh
nix-profile.sh
nix-shell.sh
nix_path.sh
optimise-store.sh
output-normalization.sh
parallel.builder.sh
parallel.nix
parallel.sh
pass-as-file.sh
path-from-hash-part.sh
path.nix Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
placeholders.sh
plugins.sh
post-hook.sh
pure-eval.nix
pure-eval.sh
push-to-store-old.sh
push-to-store.sh
read-only-store.sh
readfile-context.nix
readfile-context.sh
recursive.nix Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
recursive.sh
referrers.sh
remote-store.sh
repair.sh
repl.sh Merge pull request #9926 from 9999years/fix-cycle-detection-in-nix-repl 2024-03-09 03:37:35 -07:00
restricted.nix
restricted.sh
search.nix
search.sh
secure-drv-outputs.nix
secure-drv-outputs.sh
selfref-gc.sh
shell-hello.nix
shell.nix
shell.sh
shell.shebang.nix Merge pull request #8470 from ncfavier/shebang-single-quotes 2024-03-04 05:06:32 +01:00
shell.shebang.rb
shell.shebang.sh
signing.sh
simple-failing.nix
simple.builder.sh
simple.nix
simple.sh Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
ssh-relay.sh
store-ping.sh
structured-attrs-shell.nix
structured-attrs.nix
structured-attrs.sh
substitute-with-invalid-ca.sh
suggestions.sh Put functional tests in tests/functional 2023-12-01 12:06:43 -05:00
supplementary-groups.sh
tarball.sh
test-infra.sh
test-libstoreconsumer.sh
timeout.nix
timeout.sh
toString-path.sh
undefined-variable.nix
user-envs-migration.sh
user-envs.builder.sh
user-envs.nix
user-envs.sh
why-depends.sh
zstd.sh