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