Skip to content
Snippets Groups Projects
Commit 23489a29 authored by Bruce Flynn's avatar Bruce Flynn
Browse files

Handle type converstion issues when parsing records.

parent 228c283f
No related branches found
No related tags found
No related merge requests found
......@@ -75,7 +75,11 @@ def _make_record(data):
if key == 'stamp':
continue
if key in database:
data[key] = database[key].type(data[key])
try:
data[key] = database[key].type(data[key])
except (ValueError, TypeError) as err:
raise LineParseError("error converting '%s' using %s",
data[key], database[key].type)
return data
......
......@@ -52,6 +52,6 @@ if __name__ == '__main__':
for record in read_records(fpath):
try:
rrd.add_record(record['stamp'], record)
except ModelError:
LOG.exception("Could not insert: %s", record)
except ModelError as err:
LOG.error("Insert failed: %s", err)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment