From 5e6de17902f73ea0ac48eeda77216a302bd0872f Mon Sep 17 00:00:00 2001 From: "Kali Kaneko (leap communications)" Date: Tue, 18 Apr 2017 21:03:36 +0200 Subject: [refactor] use str repr of exception --- src/leap/bitmask/cli/bitmask_cli.py | 12 +++++------- src/leap/bitmask/cli/vpn.py | 3 +-- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/leap/bitmask/cli/bitmask_cli.py b/src/leap/bitmask/cli/bitmask_cli.py index f138e486..839b7f5c 100755 --- a/src/leap/bitmask/cli/bitmask_cli.py +++ b/src/leap/bitmask/cli/bitmask_cli.py @@ -150,7 +150,7 @@ def execute(): errb=lambda: cli.start(args)) except Exception, e: print (Fore.RED + "ERROR: " + Fore.RESET + - "%s" % e.strerror) + "%s" % str(e)) defer.returnValue('') cli.data = [] @@ -164,12 +164,10 @@ def execute(): if 'start' in sys.argv or 'restart' in sys.argv: command.default_dict_printer({'start': 'ok'}) except Exception, e: - if hasattr(e, 'strerror'): - print (Fore.RED + "ERROR: " + Fore.RESET + - "%s" % e.strerror) - else: - if not hasattr(e, 'expected'): - print traceback.format_exc() + print(Fore.RED + "ERROR: " + Fore.RESET + + "%s" % str(e)) + if not hasattr(e, 'expected'): + print(traceback.format_exc()) finally: yield reactor.stop() diff --git a/src/leap/bitmask/cli/vpn.py b/src/leap/bitmask/cli/vpn.py index 0c5eddec..1c7ad3b4 100644 --- a/src/leap/bitmask/cli/vpn.py +++ b/src/leap/bitmask/cli/vpn.py @@ -62,8 +62,7 @@ SUBCOMMANDS: try: _, provider = uid.split('@') except ValueError: - error = ValueError() - error.strerror = "A provider is needed to start the VPN" + error = ValueError("A provider is needed to start the VPN") error.expected = True raise error -- cgit v1.2.3