URI: 
       tinterface: change how GracefulDisconnect is handled - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 1419a5c60d7dc3b0f45846c3d5873b4b32d147b1
   DIR parent 6f7a065081dd28b552ae43238a95685edc6aa424
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Wed, 12 Sep 2018 18:43:50 +0200
       
       interface: change how GracefulDisconnect is handled
       
       Diffstat:
         M electrum/interface.py               |      13 +++++++++++--
       
       1 file changed, 11 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/electrum/interface.py b/electrum/interface.py
       t@@ -96,8 +96,7 @@ class NotificationSession(ClientSession):
                return str(method) + repr(params)
        
        
       -# FIXME this is often raised inside a TaskGroup, but then it's not silent :(
       -class GracefulDisconnect(AIOSafeSilentException): pass
       +class GracefulDisconnect(Exception): pass
        
        
        class ErrorParsingSSLCert(Exception): pass
       t@@ -226,7 +225,17 @@ class Interface(PrintError):
                    sslc.check_hostname = 0
                return sslc
        
       +    def handle_graceful_disconnect(func):
       +        async def wrapper_func(self, *args, **kwargs):
       +            try:
       +                return await func(self, *args, **kwargs)
       +            except GracefulDisconnect as e:
       +                self.print_error("disconnecting gracefully. {}".format(e))
       +                self.exception = e
       +        return wrapper_func
       +
            @aiosafe
       +    @handle_graceful_disconnect
            async def run(self):
                try:
                    ssl_context = await self._get_ssl_context()