Skip to content

Commit

Permalink
catch api exceptions due to workaround with timestamp format in night…
Browse files Browse the repository at this point in the history
…scout (#71)
  • Loading branch information
jwoglom committed Dec 13, 2022
1 parent 62f1322 commit cabbc78
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tconnectsync/nightscout.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,18 @@ def internal(t_to_space):
return j[0]
return None

ret = internal(False)
ret = None
try:
ret = internal(False)
except ApiException as e:
logger.warning("last_uploaded_entry with no t_to_space: %s", e)
ret = None
if ret is None and (time_start or time_end):
ret = internal(True)
try:
ret = internal(True)
except ApiException as e:
logger.warning("last_uploaded_entry with t_to_space: %s", e)
ret = None
if ret is not None:
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))
return ret
Expand Down

0 comments on commit cabbc78

Please sign in to comment.