summaryrefslogtreecommitdiffstats
path: root/glucometerutils/exceptions.py
diff options
context:
space:
mode:
Diffstat (limited to 'glucometerutils/exceptions.py')
-rw-r--r--glucometerutils/exceptions.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/glucometerutils/exceptions.py b/glucometerutils/exceptions.py
index 53aa980..52e4d22 100644
--- a/glucometerutils/exceptions.py
+++ b/glucometerutils/exceptions.py
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: MIT
"""Common exceptions for glucometerutils."""
+
class Error(Exception):
"""Base class for the errors."""
@@ -14,7 +15,7 @@ class CommandLineError(Error):
class ConnectionFailed(Error):
"""It was not possible to connect to the meter."""
- def __init__(self, message='Unable to connect to the meter.'):
+ def __init__(self, message="Unable to connect to the meter."):
super(ConnectionFailed, self).__init__(message)
@@ -30,14 +31,16 @@ class InvalidResponse(Error):
def __init__(self, response):
super(InvalidResponse, self).__init__(
- 'Invalid response received:\n%s' % response)
+ "Invalid response received:\n%s" % response
+ )
class InvalidChecksum(InvalidResponse):
def __init__(self, wire, calculated):
super(InvalidChecksum, self).__init__(
- 'Response checksum not matching: %08x (wire) != %08x (calculated)' %
- (wire, calculated))
+ "Response checksum not matching: %08x (wire) != %08x (calculated)"
+ % (wire, calculated)
+ )
class InvalidGlucoseUnit(Error):
@@ -45,12 +48,12 @@ class InvalidGlucoseUnit(Error):
def __init__(self, unit):
super(InvalidGlucoseUnit, self).__init__(
- 'Invalid glucose unit received:\n%s' % unit)
+ "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')
+ super(InvalidDateTime, self).__init__("Invalid date and time for device")