From 783ae018c61526f1b5e88f8d82e87c2955ba82bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Mon, 1 Jul 2019 20:49:29 +0100 Subject: Introduce an explicit InvalidDateTime exception for meters with unset time. At least the FreeStyle Precision Neo appears to be able to report an invalid date/time (255/255/255 255:255), probably when the RTC is lost (see issue #58). This returns a more precise output than N/A, and should suggest to confirm the date and time setting instead. --- glucometerutils/exceptions.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'glucometerutils/exceptions.py') diff --git a/glucometerutils/exceptions.py b/glucometerutils/exceptions.py index 415c97f..1cc8cfd 100644 --- a/glucometerutils/exceptions.py +++ b/glucometerutils/exceptions.py @@ -46,3 +46,11 @@ class InvalidGlucoseUnit(Error): def __init__(self, unit): super(InvalidGlucoseUnit, self).__init__( 'Invalid glucose unit received:\n%s' % unit) + + +class InvalidDateTime(Error): + """The device has an invalid date/time setting.""" + + def __init__(self): + super(InvalidDateTime, self).__init__( + 'Invalid date and time for device') -- cgit v1.2.3