diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2018-12-12 23:16:57 +0100 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2018-12-12 23:16:57 +0100 |
commit | b1b2d814c0bdc883096bb8a23d397d5510189f9e (patch) | |
tree | 5e92df9bcad097d127c55be2240f47e05dff433e /glucometerutils/exceptions.py | |
parent | hiddevice: split handle_ and hidapi_handle_. (diff) | |
download | glucometerutils-b1b2d814c0bdc883096bb8a23d397d5510189f9e.tar glucometerutils-b1b2d814c0bdc883096bb8a23d397d5510189f9e.tar.gz glucometerutils-b1b2d814c0bdc883096bb8a23d397d5510189f9e.tar.bz2 glucometerutils-b1b2d814c0bdc883096bb8a23d397d5510189f9e.tar.lz glucometerutils-b1b2d814c0bdc883096bb8a23d397d5510189f9e.tar.xz glucometerutils-b1b2d814c0bdc883096bb8a23d397d5510189f9e.tar.zst glucometerutils-b1b2d814c0bdc883096bb8a23d397d5510189f9e.zip |
Diffstat (limited to 'glucometerutils/exceptions.py')
-rw-r--r-- | glucometerutils/exceptions.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/glucometerutils/exceptions.py b/glucometerutils/exceptions.py index e1d9200..9a0f1fd 100644 --- a/glucometerutils/exceptions.py +++ b/glucometerutils/exceptions.py @@ -7,49 +7,49 @@ __copyright__ = 'Copyright © 2013, Diego Elio Pettenò' __license__ = 'MIT' class Error(Exception): - """Base class for the errors.""" + """Base class for the errors.""" - def __str__(self): - return self.message + def __str__(self): + return self.message class CommandLineError(Error): - """Error with commandline parameters provided.""" + """Error with commandline parameters provided.""" - def __init__(self, message=''): - self.message = message + def __init__(self, message=''): + self.message = message class ConnectionFailed(Error): - """It was not possible to connect to the meter.""" + """It was not possible to connect to the meter.""" - def __init__(self, message='Unable to connect to the meter.'): - self.message = message + def __init__(self, message='Unable to connect to the meter.'): + self.message = message class CommandError(Error): - """It was not possible to send a command to the device.""" + """It was not possible to send a command to the device.""" - def __init__(self, message="Unable to send command to device."): - self.message = message + def __init__(self, message="Unable to send command to device."): + self.message = message class InvalidResponse(Error): - """The response received from the meter was not understood""" + """The response received from the meter was not understood""" - def __init__(self, response): - self.message = 'Invalid response received:\n%s' % response + def __init__(self, response): + self.message = 'Invalid response received:\n%s' % response class InvalidChecksum(InvalidResponse): - def __init__(self, expected, gotten): - self.message = ( - 'Response checksum not matching: %08x expected, %08x gotten' % - (expected, gotten)) + def __init__(self, expected, gotten): + self.message = ( + 'Response checksum not matching: %08x expected, %08x gotten' % + (expected, gotten)) class InvalidGlucoseUnit(Error): - """Unable to parse the given glucose unit""" + """Unable to parse the given glucose unit""" - def __init__(self, unit): - self.message = 'Invalid glucose unit received:\n%s' % unit + def __init__(self, unit): + self.message = 'Invalid glucose unit received:\n%s' % unit |