Slightly improve option type error messages
This commit is contained in:
parent
0ec10c57df
commit
6de7886fb8
|
@ -11,10 +11,7 @@ with import ./properties.nix;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
inherit (lib) isType;
|
isOption = lib.isType "option";
|
||||||
|
|
||||||
|
|
||||||
isOption = isType "option";
|
|
||||||
mkOption = attrs: attrs // {
|
mkOption = attrs: attrs // {
|
||||||
_type = "option";
|
_type = "option";
|
||||||
# name (this is the name of the attributem it is automatically generated by the traversal)
|
# name (this is the name of the attributem it is automatically generated by the traversal)
|
||||||
|
@ -66,7 +63,7 @@ rec {
|
||||||
if all opt.check list then
|
if all opt.check list then
|
||||||
opt.merge list
|
opt.merge list
|
||||||
else
|
else
|
||||||
throw "One of option ${name} values has a bad type.";
|
throw "A value of the option `${name}' has a bad type.";
|
||||||
}
|
}
|
||||||
else opt;
|
else opt;
|
||||||
|
|
||||||
|
@ -77,7 +74,7 @@ rec {
|
||||||
if opt.check opt.default then
|
if opt.check opt.default then
|
||||||
opt.default
|
opt.default
|
||||||
else
|
else
|
||||||
throw "The default value of option ${name} has a bad type.";
|
throw "The default value of the option `${name}' has a bad type.";
|
||||||
}
|
}
|
||||||
else opt;
|
else opt;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue