Catch parsing error when time does not decode
This commit is contained in:
parent
6f054b81db
commit
39ac4c9711
1 changed files with 9 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# 2012 Nico Schottelius (nico-ctt at schottelius.org)
|
# 2012-2018 Nico Schottelius (nico-ctt at schottelius.org)
|
||||||
# 2016 Darko Poljak (darko.poljak at gmail.com)
|
# 2016 Darko Poljak (darko.poljak at gmail.com)
|
||||||
#
|
#
|
||||||
# This file is part of ctt.
|
# This file is part of ctt.
|
||||||
|
@ -238,6 +238,7 @@ class Report(object):
|
||||||
'''
|
'''
|
||||||
report = {}
|
report = {}
|
||||||
start_datetime = datetime.datetime.strptime(time, ctt.DATETIMEFORMAT)
|
start_datetime = datetime.datetime.strptime(time, ctt.DATETIMEFORMAT)
|
||||||
|
|
||||||
delta = datetime.timedelta(seconds=int(float(entry['delta'])))
|
delta = datetime.timedelta(seconds=int(float(entry['delta'])))
|
||||||
end_datetime = (start_datetime + delta).replace(microsecond=0)
|
end_datetime = (start_datetime + delta).replace(microsecond=0)
|
||||||
|
|
||||||
|
@ -261,7 +262,13 @@ class Report(object):
|
||||||
time_keys = self._report_db.keys()
|
time_keys = self._report_db.keys()
|
||||||
for time in time_keys:
|
for time in time_keys:
|
||||||
entry = self._report_db[time]
|
entry = self._report_db[time]
|
||||||
report = self._get_report_entry(time, entry)
|
|
||||||
|
try:
|
||||||
|
report = self._get_report_entry(time, entry)
|
||||||
|
except ValueError as e:
|
||||||
|
log.error("Cannot parse entry {}: {}".format(time, e))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if time not in entries:
|
if time not in entries:
|
||||||
entries[time] = [report]
|
entries[time] = [report]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue