lib/modules: Evaluate single defs for readOnly error
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.
This commit is contained in:
parent
bdfcee2590
commit
910dfdc41e
@ -449,7 +449,13 @@ rec {
|
|||||||
# Handle properties, check types, and merge everything together.
|
# Handle properties, check types, and merge everything together.
|
||||||
res =
|
res =
|
||||||
if opt.readOnly or false && length defs' > 1 then
|
if opt.readOnly or false && length defs' > 1 then
|
||||||
throw "The option `${showOption loc}' is read-only, but it's set multiple times. Definition values:${showDefs defs'}"
|
let
|
||||||
|
# For a better error message, evaluate all readOnly definitions as
|
||||||
|
# if they were the only definition.
|
||||||
|
separateDefs = map (def: def // {
|
||||||
|
value = (mergeDefinitions loc opt.type [ def ]).mergedValue;
|
||||||
|
}) defs';
|
||||||
|
in throw "The option `${showOption loc}' is read-only, but it's set multiple times. Definition values:${showDefs separateDefs}"
|
||||||
else
|
else
|
||||||
mergeDefinitions loc opt.type defs';
|
mergeDefinitions loc opt.type defs';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user