plugins: hardware: HardwareHandlerBase.show_error() takes str, not exc
This is just a minor conceptual clean-up, runtime behaviour is not being changed, as ultimately, much later in the exec flow, the msg object being passed around is cast to str already. (e.g. see str(text) at https://github.com/spesmilo/electrum/blob/4f7b6e897710338e8a4cfb8fa97c305218bdff88/electrum/gui/qt/util.py#L375-L379)
This commit is contained in:
@@ -577,10 +577,10 @@ class BitBox02_KeyStore(Hardware_KeyStore):
|
|||||||
super().__init__(d)
|
super().__init__(d)
|
||||||
self.ux_busy = False
|
self.ux_busy = False
|
||||||
|
|
||||||
def give_error(self, message: Exception):
|
def give_error(self, message: str | BaseException):
|
||||||
self.logger.info(message)
|
self.logger.info(message)
|
||||||
if not self.ux_busy:
|
if not self.ux_busy:
|
||||||
self.handler.show_error(message)
|
self.handler.show_error(str(message))
|
||||||
else:
|
else:
|
||||||
self.ux_busy = False
|
self.ux_busy = False
|
||||||
raise UserFacingException(message)
|
raise UserFacingException(message)
|
||||||
@@ -636,7 +636,7 @@ class BitBox02_KeyStore(Hardware_KeyStore):
|
|||||||
self.handler.finished()
|
self.handler.finished()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.exception("")
|
self.logger.exception("")
|
||||||
self.handler.show_error(e)
|
self.handler.show_error(str(e))
|
||||||
|
|
||||||
|
|
||||||
class BitBox02Plugin(HW_PluginBase):
|
class BitBox02Plugin(HW_PluginBase):
|
||||||
|
|||||||
@@ -301,10 +301,10 @@ class Coldcard_KeyStore(Hardware_KeyStore):
|
|||||||
|
|
||||||
return client
|
return client
|
||||||
|
|
||||||
def give_error(self, message):
|
def give_error(self, message: str | BaseException):
|
||||||
self.logger.info(message)
|
self.logger.info(message)
|
||||||
if not self.ux_busy:
|
if not self.ux_busy:
|
||||||
self.handler.show_error(message)
|
self.handler.show_error(str(message))
|
||||||
else:
|
else:
|
||||||
self.ux_busy = False
|
self.ux_busy = False
|
||||||
raise UserFacingException(message)
|
raise UserFacingException(message)
|
||||||
@@ -460,7 +460,7 @@ class Coldcard_KeyStore(Hardware_KeyStore):
|
|||||||
_('Error showing address') + ':', str(exc)))
|
_('Error showing address') + ':', str(exc)))
|
||||||
except BaseException as exc:
|
except BaseException as exc:
|
||||||
self.logger.exception('')
|
self.logger.exception('')
|
||||||
self.handler.show_error(exc)
|
self.handler.show_error(str(exc))
|
||||||
|
|
||||||
@wrap_busy
|
@wrap_busy
|
||||||
def show_p2sh_address(self, M, script, xfp_paths, txin_type):
|
def show_p2sh_address(self, M, script, xfp_paths, txin_type):
|
||||||
@@ -482,7 +482,7 @@ class Coldcard_KeyStore(Hardware_KeyStore):
|
|||||||
str(exc)))
|
str(exc)))
|
||||||
except BaseException as exc:
|
except BaseException as exc:
|
||||||
self.logger.exception('')
|
self.logger.exception('')
|
||||||
self.handler.show_error(exc)
|
self.handler.show_error(str(exc))
|
||||||
|
|
||||||
|
|
||||||
class ColdcardPlugin(HW_PluginBase):
|
class ColdcardPlugin(HW_PluginBase):
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ class DigitalBitbox_KeyStore(Hardware_KeyStore):
|
|||||||
Hardware_KeyStore.__init__(self, d)
|
Hardware_KeyStore.__init__(self, d)
|
||||||
self.maxInputs = 14 # maximum inputs per single sign command
|
self.maxInputs = 14 # maximum inputs per single sign command
|
||||||
|
|
||||||
def give_error(self, message):
|
def give_error(self, message: str | BaseException):
|
||||||
raise Exception(message)
|
raise Exception(message)
|
||||||
|
|
||||||
def decrypt_message(self, pubkey, message, password):
|
def decrypt_message(self, pubkey, message, password):
|
||||||
|
|||||||
@@ -403,10 +403,10 @@ class Ledger_Client_Legacy(Ledger_Client):
|
|||||||
self.signing = False
|
self.signing = False
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
def give_error(self, message):
|
def give_error(self, message: str | BaseException):
|
||||||
_logger.info(message)
|
_logger.info(message)
|
||||||
if not self.signing:
|
if not self.signing:
|
||||||
self.handler.show_error(message)
|
self.handler.show_error(str(message))
|
||||||
else:
|
else:
|
||||||
self.signing = False
|
self.signing = False
|
||||||
raise UserFacingException(message)
|
raise UserFacingException(message)
|
||||||
@@ -545,10 +545,10 @@ class Ledger_Client_Legacy(Ledger_Client):
|
|||||||
_('Your device might not have support for this functionality.')))
|
_('Your device might not have support for this functionality.')))
|
||||||
else:
|
else:
|
||||||
_logger.exception('')
|
_logger.exception('')
|
||||||
self.handler.show_error(e)
|
self.handler.show_error(str(e))
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
_logger.exception('')
|
_logger.exception('')
|
||||||
self.handler.show_error(e)
|
self.handler.show_error(str(e))
|
||||||
finally:
|
finally:
|
||||||
self.handler.finished()
|
self.handler.finished()
|
||||||
|
|
||||||
@@ -959,7 +959,7 @@ class Ledger_Client_New(Ledger_Client):
|
|||||||
pass # cancelled by user
|
pass # cancelled by user
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
_logger.exception('Error while showing an address')
|
_logger.exception('Error while showing an address')
|
||||||
self.handler.show_error(e)
|
self.handler.show_error(str(e))
|
||||||
finally:
|
finally:
|
||||||
self.handler.finished()
|
self.handler.finished()
|
||||||
|
|
||||||
@@ -1139,7 +1139,7 @@ class Ledger_Client_New(Ledger_Client):
|
|||||||
pass # cancelled by user
|
pass # cancelled by user
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
_logger.exception('Error while signing')
|
_logger.exception('Error while signing')
|
||||||
self.handler.show_error(e)
|
self.handler.show_error(str(e))
|
||||||
finally:
|
finally:
|
||||||
self.handler.finished()
|
self.handler.finished()
|
||||||
|
|
||||||
@@ -1166,7 +1166,7 @@ class Ledger_Client_New(Ledger_Client):
|
|||||||
pass # cancelled by user
|
pass # cancelled by user
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
_logger.exception('')
|
_logger.exception('')
|
||||||
self.handler.show_error(e)
|
self.handler.show_error(str(e))
|
||||||
finally:
|
finally:
|
||||||
self.handler.finished()
|
self.handler.finished()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user