Better handling of empty type/name attributes in YAML config.

From #38
This commit is contained in:
Salvador E. Tropea 2021-01-04 16:27:52 -03:00
parent 9b5fa66b2d
commit edd4a72277
3 changed files with 10 additions and 1 deletions

View File

@ -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?

View File

@ -5,6 +5,7 @@ outputs:
- name: PDF
comment: "PDF files"
dir: PDF
type:
options:
exclude_edge_layer: false
exclude_pads_from_silkscreen: false

View File

@ -3,4 +3,4 @@ kibot:
variants:
- name: ok
type: ''
type: 'foobar'