protocol: print the DeviceError as something useful
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
88d9cf14bd
commit
7a121cfe6c
|
@ -446,6 +446,12 @@ class DeviceError(ProtocolError):
|
|||
if self.errorcode == DeviceError.ErrorCode.INVALID_STATE:
|
||||
self.errno = errno.EBADE
|
||||
|
||||
def __repr__(self):
|
||||
return f'DeviceError.{self.errorcode.name}'
|
||||
|
||||
def __str__(self):
|
||||
return repr(self)
|
||||
|
||||
|
||||
class Msg(object):
|
||||
'''
|
||||
|
|
|
@ -23,7 +23,7 @@ from gi.repository import GObject
|
|||
from .drawing import Drawing
|
||||
from .uhid import UHIDDevice
|
||||
import tuhi.protocol
|
||||
from tuhi.protocol import NordicData, Interactions, Mode, ProtocolVersion, StrokeFile, UnexpectedDataError, DeviceError, MissingReplyError
|
||||
from tuhi.protocol import NordicData, Interactions, Mode, ProtocolVersion, StrokeFile, UnexpectedDataError, DeviceError, MissingReplyError, AuthorizationError
|
||||
from .util import list2hex, flatten
|
||||
from tuhi.config import TuhiConfig
|
||||
|
||||
|
@ -1017,6 +1017,9 @@ class WacomDevice(GObject.Object):
|
|||
except DeviceError as e:
|
||||
logger.error(f'**** Exception: {e} ****')
|
||||
exception = e
|
||||
except AuthorizationError as e:
|
||||
logger.error(f'Authorization failed, device needs to be re-registered')
|
||||
exception = e
|
||||
finally:
|
||||
self.sync_state = 0
|
||||
self._is_running = False
|
||||
|
|
Loading…
Reference in New Issue