diff options
Diffstat (limited to '')
-rw-r--r-- | glucometerutils/exceptions.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/glucometerutils/exceptions.py b/glucometerutils/exceptions.py index 00c9e91..1acf9a4 100644 --- a/glucometerutils/exceptions.py +++ b/glucometerutils/exceptions.py @@ -9,22 +9,19 @@ __license__ = 'GPL v3 or later' class Error(Exception): """Base class for the errors.""" + def __str__(self): + return self.message + class InvalidResponse(Error): """The response received from the meter was not understood""" def __init__(self, response): - self.response = response - - def __str__(self): - return 'Invalid response received:\n%s' % self.response + self.message = 'Invalid response received:\n%s' % response class InvalidGlucoseUnit(Error): """Unable to parse the given glucose unit""" def __init__(self, unit): - self.unit = unit - - def __str__(self): - return 'Invalid glucose unit received:\n%s' % self.unit + self.message = 'Invalid glucose unit received:\n%s' % unit |