Skip to content

Commit cabbc78

Browse files
committed
catch api exceptions due to workaround with timestamp format in nightscout (#71)
1 parent 62f1322 commit cabbc78

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

tconnectsync/nightscout.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,18 @@ def internal(t_to_space):
7777
return j[0]
7878
return None
7979

80-
ret = internal(False)
80+
ret = None
81+
try:
82+
ret = internal(False)
83+
except ApiException as e:
84+
logger.warning("last_uploaded_entry with no t_to_space: %s", e)
85+
ret = None
8186
if ret is None and (time_start or time_end):
82-
ret = internal(True)
87+
try:
88+
ret = internal(True)
89+
except ApiException as e:
90+
logger.warning("last_uploaded_entry with t_to_space: %s", e)
91+
ret = None
8392
if ret is not None:
8493
logger.warning("last_uploaded_entry with eventType=%s time_start=%s time_end=%s only returned data when timestamps contained a space" % (eventType, time_start, time_end))
8594
return ret

0 commit comments

Comments
 (0)