feat: Improved error message for missing struct fields
This commit is contained in:
parent
4ebc069a3f
commit
ca0cf11ca9
2 changed files with 2 additions and 1 deletions
|
@ -35,7 +35,8 @@ with builtins; let
|
||||||
type = def."${field}";
|
type = def."${field}";
|
||||||
checked = type.check fieldVal;
|
checked = type.check fieldVal;
|
||||||
in if checked then (current && true)
|
in if checked then (current && true)
|
||||||
else (throw "Field ${field} is of type ${typeOf fieldVal}, but expected ${type.name}");
|
else if isNull fieldVal then (throw "Missing required ${type.name} field '${field}'")
|
||||||
|
else (throw "Field ${field} is of type ${typeOf fieldVal}, but expected ${type.name}");
|
||||||
|
|
||||||
checkExtraneous = name: def: present:
|
checkExtraneous = name: def: present:
|
||||||
if (length present) == 0 then true
|
if (length present) == 0 then true
|
||||||
|
|
BIN
z-structs.png
BIN
z-structs.png
Binary file not shown.
Before Width: | Height: | Size: 66 KiB After Width: | Height: | Size: 68 KiB |
Loading…
Reference in a new issue