Improve error messages.
Improve function name: ensureDefaultType: It runs the check function, so checkDefault is much easier to understand.
This commit is contained in:
parent
52204af457
commit
7a76598447
|
@ -66,18 +66,18 @@ rec {
|
||||||
if all opt.check list then
|
if all opt.check list then
|
||||||
opt.merge list
|
opt.merge list
|
||||||
else
|
else
|
||||||
throw "One of the definitions has a bad type.";
|
throw "One of option ${name} values is of a bad type.";
|
||||||
}
|
}
|
||||||
else opt;
|
else opt;
|
||||||
|
|
||||||
ensureDefaultType = opt:
|
checkDefault = opt:
|
||||||
if opt ? check && opt ? default then
|
if opt ? check && opt ? default then
|
||||||
opt // {
|
opt // {
|
||||||
default =
|
default =
|
||||||
if opt.check opt.default then
|
if opt.check opt.default then
|
||||||
opt.default
|
opt.default
|
||||||
else
|
else
|
||||||
throw "The default value has a bad type.";
|
throw "The default value of option ${name} is of a bad type.";
|
||||||
}
|
}
|
||||||
else opt;
|
else opt;
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ rec {
|
||||||
|
|
||||||
# override settings
|
# override settings
|
||||||
ensureMergeInputType
|
ensureMergeInputType
|
||||||
ensureDefaultType
|
checkDefault
|
||||||
handleOptionSets
|
handleOptionSets
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue