Add event names and fix exception display
parent
5e9372d394
commit
95e4e59e3d
|
@ -13,6 +13,8 @@ from collections import namedtuple
|
|||
|
||||
|
||||
class Event(namedtuple('Event', ['code', 'args'])):
|
||||
def __repr__(self):
|
||||
return '<%s: %s>' % (super(Event, self).__repr__(), self)
|
||||
def __str__(self):
|
||||
return constants.poll_codes[self.code] \
|
||||
if self.code in constants.poll_codes \
|
||||
|
|
|
@ -9,7 +9,8 @@ class InvalidChecksumException(eSSPException): pass
|
|||
|
||||
class DeviceError(eSSPException):
|
||||
def __str__(self):
|
||||
if self.msg in self.error_codes:
|
||||
return constants.error_codes[self.msg]
|
||||
msg = self.args[0]
|
||||
if msg in constants.error_codes:
|
||||
return constants.error_codes[msg]
|
||||
else:
|
||||
return 'Unknown error (0x%02X)' % self.msg
|
||||
return 'Unknown error (0x%02X)' % msg
|
||||
|
|
Loading…
Reference in New Issue