aboutsummaryrefslogtreecommitdiff
path: root/doc/manual/rl-next/with-error-reporting.md
blob: 8258fd51bf98d0e3f589c02164f219d203c5225a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
synopsis: Better error reporting for `with` expressions
prs: 9658
cls: 207
credits: horrors
category: Improvements
---

`with` expressions using non-attrset values to resolve variables are now reported with proper positions.

Previously an incorrect `with` expression would report no position at all, making it hard to determine where the error originated:

```
nix-repl> with 1; a
error:
       … <borked>

         at «none»:0: (source not available)

       error: value is an integer while a set was expected
```

Now position information is preserved and reported as with most other errors:

```
nix-repl> with 1; a
error:
       … while evaluating the first subexpression of a with expression
         at «string»:1:1:
            1| with 1; a
             | ^

       error: expected a set but found an integer: 1
```