improve templateNode missing message
This commit is contained in:
parent
52e3931a43
commit
7b11d1b7fa
1 changed files with 26 additions and 27 deletions
|
|
@ -51,14 +51,13 @@
|
|||
|
||||
mkNexusConfig = config: let
|
||||
# abstract node instance that stores all default values
|
||||
templateNode = let
|
||||
templateNode = name: system: let
|
||||
missing = msg: path:
|
||||
builtins.abort ''
|
||||
Each Cerulean Nexus node is required to specify ${msg}!
|
||||
Ensure `cerulean.nexus.nodes.$${NODE}.${path}` exists under your call to `cerulean.mkNexus`.
|
||||
Ensure `cerulean.nexus.nodes.${name}.${path}` exists under your call to `cerulean.mkNexus`.
|
||||
'';
|
||||
in
|
||||
system: {
|
||||
in {
|
||||
system = missing "its system type" "system"; # intentionally left missing!! (to raise errors)
|
||||
modules = missing "its required modules" "modules";
|
||||
specialArgs = {
|
||||
|
|
@ -99,7 +98,7 @@
|
|||
''
|
||||
# TODO: nodeAttrs.system won't display any nice error messages!!
|
||||
# TODO: will mergeTypedStruct give nice error messages? or should I use mergeStructErr directly?
|
||||
else nib.parse.mergeTypedStruct (templateNode nodeAttrs.system) nodeAttrs;
|
||||
else nib.parse.mergeTypedStruct (templateNode name nodeAttrs.system) nodeAttrs;
|
||||
|
||||
# TODO: mapNodes = f: builtins.mapAttrs (name: nodeAttrs: f name (parseNode name nodeAttrs)) config.nexus.nodes
|
||||
mapNodes = f: builtins.mapAttrs f (builtins.mapAttrs parseNode config.nexus.nodes);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue