1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Revert "Print the value in error: cannot coerce messages (#9553)"

This reverts commit f0ac2a35d5.

The request from the sibling PR, which also applies here, was not addressed.
https://github.com/NixOS/nix/pull/9554#issuecomment-1845095735
This commit is contained in:
Robert Hensing 2023-12-09 02:13:32 +01:00
parent d4f6b1d38b
commit 9b7b7a7561
6 changed files with 21 additions and 73 deletions

View file

@ -1,50 +0,0 @@
synopsis: Coercion errors include the failing value
issues: #561
prs: #9553
description: {
The `error: cannot coerce a <TYPE> to a string` message now includes the value which caused the error.
Previously, a failed string coercion produced a confusing error message if the trace didn't show where the offending value was defined:
```bash
$ nix-instantiate --eval --expr '
let x = { a = 1; }; in
"${x}"
'
error:
… while evaluating a path segment
at «string»:4:2:
3|
4| "${x}"
| ^
5|
error: cannot coerce a set to a string
```
Now, the error message includes the value itself:
```bash
$ nix-instantiate --eval --expr '
let x = { a = 1; }; in
"${x}"
'
error:
… while evaluating a path segment
at «string»:4:2:
3|
4| "${x}"
| ^
5|
error: cannot coerce a set to a string: { a = 1; }
```
}