URI: 
       tdistinguish invalid otp from server failure when sending tx - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 4fea9edd11f66536c5f6c56f8b0fabaaa18ca612
   DIR parent 27012e7394ce5230269a2c59e8a4df12253e75a7
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Fri,  8 Jun 2018 13:42:41 +0200
       
       distinguish invalid otp from server failure when sending tx
       
       Diffstat:
         M plugins/trustedcoin/kivy.py         |      15 ++++++++++-----
       
       1 file changed, 10 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/plugins/trustedcoin/kivy.py b/plugins/trustedcoin/kivy.py
       t@@ -32,7 +32,7 @@ from kivy.clock import Clock
        
        from electrum.i18n import _
        from electrum.plugins import hook
       -from .trustedcoin import TrustedCoinPlugin, server, KIVY_DISCLAIMER
       +from .trustedcoin import TrustedCoinPlugin, server, KIVY_DISCLAIMER, TrustedCoinException
        
        
        
       t@@ -62,10 +62,15 @@ class Plugin(TrustedCoinPlugin):
            def on_otp(self, wallet, tx, otp, on_success, on_failure):
                try:
                    wallet.on_otp(tx, otp)
       -        except:
       -            Clock.schedule_once(lambda dt: on_failure(_("Invalid OTP")))
       -            return
       -        on_success(tx)
       +        except TrustedCoinException as e:
       +            if e.status_code == 400:  # invalid OTP
       +                Clock.schedule_once(lambda dt: on_failure(_('Invalid one-time password.')))
       +            else:
       +                Clock.schedule_once(lambda dt, bound_e=e: on_failure(_('Error') + ':' + str(bound_e)))
       +        except Exception as e:
       +            Clock.schedule_once(lambda dt, bound_e=e: on_failure(_('Error') + ':' + str(bound_e)))
       +        else:
       +            on_success(tx)
        
            def accept_terms_of_use(self, wizard):
                tos = server.get_terms_of_service()