Merge pull request #95446 from Ma27/improve-opt-not-defined-error
lib/modules: improve error-message for undeclared options if prefix contains no options
This commit is contained in:
commit
f8962fd92e
@ -115,8 +115,19 @@ rec {
|
|||||||
|
|
||||||
checkUnmatched =
|
checkUnmatched =
|
||||||
if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
|
if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
|
||||||
let firstDef = head merged.unmatchedDefns;
|
let
|
||||||
in throw "The option `${showOption (prefix ++ firstDef.prefix)}' defined in `${firstDef.file}' does not exist."
|
firstDef = head merged.unmatchedDefns;
|
||||||
|
baseMsg = "The option `${showOption (prefix ++ firstDef.prefix)}' defined in `${firstDef.file}' does not exist.";
|
||||||
|
in
|
||||||
|
if attrNames options == [ "_module" ]
|
||||||
|
then throw ''
|
||||||
|
${baseMsg}
|
||||||
|
|
||||||
|
However there are no options defined in `${showOption prefix}'. Are you sure you've
|
||||||
|
declared your options properly? This can happen if you e.g. declared your options in `types.submodule'
|
||||||
|
under `config' rather than `options'.
|
||||||
|
''
|
||||||
|
else throw baseMsg
|
||||||
else null;
|
else null;
|
||||||
|
|
||||||
result = builtins.seq checkUnmatched {
|
result = builtins.seq checkUnmatched {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user