diff --git a/kibot/config_reader.py b/kibot/config_reader.py index 8a4b703d..15914e6f 100644 --- a/kibot/config_reader.py +++ b/kibot/config_reader.py @@ -51,11 +51,15 @@ class CfgYamlReader(object): def _parse_output(self, o_tree): try: name = o_tree['name'] + if not name: + raise KeyError except KeyError: config_error("Output needs a name in: "+str(o_tree)) try: otype = o_tree['type'] + if not otype: + raise KeyError except KeyError: config_error("Output `"+name+"` needs a type") @@ -63,6 +67,8 @@ class CfgYamlReader(object): comment = o_tree['comment'] except KeyError: comment = '' + if comment is None: + comment = '' name_type = "`"+name+"` ("+otype+")" @@ -99,6 +105,8 @@ class CfgYamlReader(object): config_error(kind_f+" needs a name in: "+str(o_tree)) try: otype = o_tree['type'] + if not otype: + raise KeyError except KeyError: config_error(kind_f+" `"+name+"` needs a type") # Is a valid type? diff --git a/tests/yaml_samples/error_no_type.kibot.yaml b/tests/yaml_samples/error_no_type.kibot.yaml index 89c71018..a88a7408 100644 --- a/tests/yaml_samples/error_no_type.kibot.yaml +++ b/tests/yaml_samples/error_no_type.kibot.yaml @@ -5,6 +5,7 @@ outputs: - name: PDF comment: "PDF files" dir: PDF + type: options: exclude_edge_layer: false exclude_pads_from_silkscreen: false diff --git a/tests/yaml_samples/error_var_wrong_type.kibot.yaml b/tests/yaml_samples/error_var_wrong_type.kibot.yaml index e66dac94..fba1cac4 100644 --- a/tests/yaml_samples/error_var_wrong_type.kibot.yaml +++ b/tests/yaml_samples/error_var_wrong_type.kibot.yaml @@ -3,4 +3,4 @@ kibot: variants: - name: ok - type: '' + type: 'foobar'