URI: 
       ttrustedcoin: nicer 'ErrorConnectingServer' exception - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 9dedf51afdeb96590c49ff2d438ae7deec2f3448
   DIR parent 4ef3eda8dae966f5b7695cd1a68a3f924a66793c
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Thu, 21 Feb 2019 23:07:19 +0100
       
       ttrustedcoin: nicer 'ErrorConnectingServer' exception
       
       Diffstat:
         M electrum/plugins/trustedcoin/trust… |      14 +++++++++++---
       
       1 file changed, 11 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/electrum/plugins/trustedcoin/trustedcoin.py b/electrum/plugins/trustedcoin/trustedcoin.py
       t@@ -29,7 +29,7 @@ import base64
        import time
        import hashlib
        from collections import defaultdict
       -from typing import Dict
       +from typing import Dict, Union
        
        from urllib.parse import urljoin
        from urllib.parse import quote
       t@@ -108,7 +108,15 @@ class TrustedCoinException(Exception):
        
        
        class ErrorConnectingServer(Exception):
       -    pass
       +    def __init__(self, reason: Union[str, Exception] = None):
       +        self.reason = reason
       +
       +    def __str__(self):
       +        header = _("Error connecting to {} server").format('TrustedCoin')
       +        reason = self.reason
       +        if isinstance(reason, BaseException):
       +            reason = repr(reason)
       +        return f"{header}:\n{reason}" if reason else header
        
        
        class TrustedCoinCosignerClient(PrintError):
       t@@ -460,7 +468,7 @@ class TrustedCoinPlugin(BasePlugin):
                try:
                    billing_info = server.get(wallet.get_user_id()[1])
                except ErrorConnectingServer as e:
       -            self.print_error('cannot connect to TrustedCoin server: {}'.format(repr(e)))
       +            self.print_error(str(e))
                    return
                billing_index = billing_info['billing_index']
                # add segwit billing address; this will be used for actual billing