Commit 0cf89f72 authored by Klaus Zimmermann's avatar Klaus Zimmermann
Browse files

Improved metadata error reporting (closes #162)

parent b8cfb104
......@@ -29,7 +29,11 @@ class Index:
if argname in cube_mapping:
logging.info('Data found for input {}'.format(argname))
else:
raise ValueError('No data found for input {}'.format(argname))
args = ", ".join(
["{}: {}".format(argname, iv.var_name)
for argname, iv in self.metadata.input.items()])
raise ValueError('No data found for input {}. '
'Requested: ({})'.format(argname, args))
logging.info('Adding coord categorisation.')
coord_name = list(map(
self.period.add_coord_categorisation, cube_mapping.values()))[0]
......
......@@ -377,7 +377,7 @@ def load_metadata():
for name, idx_meta in idx_metadata.items():
try:
indices[name] = build_index(idx_meta, variables, path)
except KeyError:
except (KeyError, TypeError):
logging.error(
'Metadata error for index {} from {}.'.format(name, path))
raise
......
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