New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved module errors #98155
Improved module errors #98155
Conversation
I think this is really great, and the evaluation performance report indicates this is basically free -- nice! One concern:
I like this option better because it is a word somebody can say without needing to know more than English. (@infinisil suggested this specific change in a chat with him.) |
Furthermore, as @andir pointed out, the lambda and delta aren't rendered by the kernel in a TTY. (« and » do) |
What happens if definitions are very large values (or even circular/infinite, like derivations)? |
@edolstra |
Not that it needs to be of scope in this PR (as it already improves the status quo), For example when there's a conflict the user can either remove one value or use |
@domenkozar Oh great idea! I think I'll leave this for another PR indeed though. @grahamc I just pushed a change to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
Check it out: Lines 88 to 109 in 93fd4b5
|
Turns out this is what the |
The type's check function already ensured that it can't be passed non-lists
4538c0d
to
465f66c
Compare
For pretty-printing definitions, including file and values
If multiple definitions are passed, this evaluates them all as if they were the only one, for a better error message. In particular this won't show module-internal properties like `_type = "override"` and co.
465f66c
to
8908766
Compare
Changes since last revision:
As an example showcasing all of this, the error you get when you set the
|
This PR improves |
Motivation for this change
This updates NixOS module system errors to print the actual values of the definitions. It also updates the error formatting a bit. Related issues:
generators.toPretty
#97133 will improvegenerators.toPretty
, which is used by these error messagesPing @Profpatsch @roberth @grahamc
Here is an overview of the new error messages, reproducable with the following file:
Non-existant option
Multiple readOnly definitions
Wrong type
Unmergable definitions (when no type specified)
Unique option defined multiple times
Note: This is pretty much the same error condition for
readOnly
options, however this failure is specified by the type itself, rather than the option. This happens e.g. withuniq (listOf str)
ortypes.package
Conflicting definitions
Things done