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
|
||||
opt.merge list
|
||||
else
|
||||
throw "One of the definitions has a bad type.";
|
||||
throw "One of option ${name} values is of a bad type.";
|
||||
}
|
||||
else opt;
|
||||
|
||||
ensureDefaultType = opt:
|
||||
checkDefault = opt:
|
||||
if opt ? check && opt ? default then
|
||||
opt // {
|
||||
default =
|
||||
if opt.check opt.default then
|
||||
opt.default
|
||||
else
|
||||
throw "The default value has a bad type.";
|
||||
throw "The default value of option ${name} is of a bad type.";
|
||||
}
|
||||
else opt;
|
||||
|
||||
|
@ -136,7 +136,7 @@ rec {
|
|||
|
||||
# override settings
|
||||
ensureMergeInputType
|
||||
ensureDefaultType
|
||||
checkDefault
|
||||
handleOptionSets
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue