URI: 
       ttrustedcoin: friendlier error msg for invalid otp when signing - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit dac5af8eca4fc37b2b3b8a88bc66f1c660c6517b
   DIR parent 30845ee7769a66d736bbc3d451fc85c0d58e1ea1
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Sat, 22 Dec 2018 09:06:30 +0100
       
       ttrustedcoin: friendlier error msg for invalid otp when signing
       
       Diffstat:
         M electrum/plugins/trustedcoin/trust… |      10 ++++++++--
       
       1 file changed, 8 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/electrum/plugins/trustedcoin/trustedcoin.py b/electrum/plugins/trustedcoin/trustedcoin.py
       t@@ -45,7 +45,7 @@ from electrum.mnemonic import Mnemonic
        from electrum.wallet import Multisig_Wallet, Deterministic_Wallet
        from electrum.i18n import _
        from electrum.plugin import BasePlugin, hook
       -from electrum.util import NotEnoughFunds
       +from electrum.util import NotEnoughFunds, UserFacingException
        from electrum.storage import STO_EV_USER_PW
        from electrum.network import Network
        
       t@@ -319,7 +319,13 @@ class Wallet_2fa(Multisig_Wallet):
                otp = int(otp)
                long_user_id, short_id = self.get_user_id()
                raw_tx = tx.serialize()
       -        r = server.sign(short_id, raw_tx, otp)
       +        try:
       +            r = server.sign(short_id, raw_tx, otp)
       +        except TrustedCoinException as e:
       +            if e.status_code == 400:  # invalid OTP
       +                raise UserFacingException(_('Invalid one-time password.')) from e
       +            else:
       +                raise
                if r:
                    raw_tx = r.get('transaction')
                    tx.update(raw_tx)