Skip to content

Commit 29edeca

Browse files
authored
Merge pull request #3092 from migueldiascosta/dirs_sanity_check
add better error message when mandatory key is missing from a dictionary easyconfig parameter
2 parents f6bb651 + d618b0c commit 29edeca

File tree

1 file changed

+5
-1
lines changed
  • easybuild/framework/easyconfig/format

1 file changed

+5
-1
lines changed

easybuild/framework/easyconfig/format/one.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ def _reformat_line(self, param_name, param_val, outer=False, addlen=0):
161161
if isinstance(param_val, dict):
162162
ordered_item_keys = REFORMAT_ORDERED_ITEM_KEYS.get(param_name, sorted(param_val.keys()))
163163
for item_key in ordered_item_keys:
164-
item_val = param_val[item_key]
164+
if item_key in param_val:
165+
item_val = param_val[item_key]
166+
else:
167+
raise EasyBuildError("Missing mandatory key '%s' in %s.", item_key, param_name)
168+
165169
comment = self._get_item_comments(param_name, item_val).get(str(item_val), '')
166170
key_pref = quote_py_str(item_key) + ': '
167171
addlen = addlen + len(INDENT_4SPACES) + len(key_pref) + len(comment)

0 commit comments

Comments
 (0)