Commit 55164d26 by Alexander Popov

Turn some error conditions into assertions (part 4)

parent c69de43e
...@@ -747,10 +747,10 @@ def populate_simple_opt_with_data(opt, data, data_type): ...@@ -747,10 +747,10 @@ def populate_simple_opt_with_data(opt, data, data_type):
if data_type in ('kconfig', 'cmdline'): if data_type in ('kconfig', 'cmdline'):
opt.state = data.get(opt.name, None) opt.state = data.get(opt.name, None)
elif data_type == 'version':
opt.ver = data
else: else:
sys.exit('[!] ERROR: unexpected data type "{}"'.format(data_type)) assert(data_type == 'version'), \
'unexpected data type "{}"'.format(data_type)
opt.ver = data
def populate_opt_with_data(opt, data, data_type): def populate_opt_with_data(opt, data, data_type):
...@@ -762,8 +762,8 @@ def populate_opt_with_data(opt, data, data_type): ...@@ -762,8 +762,8 @@ def populate_opt_with_data(opt, data, data_type):
else: else:
populate_simple_opt_with_data(o, data, data_type) populate_simple_opt_with_data(o, data, data_type)
else: else:
if opt.type not in ('kconfig', 'cmdline'): assert(opt.type in ('kconfig', 'cmdline')), \
sys.exit('[!] ERROR: bad type "{}" for a simple check {}'.format(opt.type, opt.name)) 'bad type "{}" for a simple check'.format(opt.type)
populate_simple_opt_with_data(opt, data, data_type) populate_simple_opt_with_data(opt, data, data_type)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment