From e1dbfc454180a77ebb38ecae6244ac4abe6d0ac5 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 18 Oct 2012 09:30:53 +0900 Subject: catch cert verification errors and ask user for trust with a little helper function using gnutls --- src/leap/base/exceptions.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py index f12a49d5..227da953 100644 --- a/src/leap/base/exceptions.py +++ b/src/leap/base/exceptions.py @@ -67,6 +67,11 @@ class NoInternetConnection(CriticalError): # and now we try to connect to our web to troubleshoot LOL :P +class CannotResolveDomainError(LeapException): + message = "Cannot resolve domain" + usermessage = "Domain cannot be found" + + class TunnelNotDefaultRouteError(CriticalError): message = "Tunnel connection dissapeared. VPN down?" usermessage = "The Encrypted Connection was lost. Shutting down..." -- cgit v1.2.3 From 654b83db5f050a94f9637fb1ce80df5cb7ed5a38 Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 21 Dec 2012 07:44:59 +0900 Subject: updated "translate" to work in objects other than QObjects --- src/leap/base/exceptions.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py index 227da953..c5e56b76 100644 --- a/src/leap/base/exceptions.py +++ b/src/leap/base/exceptions.py @@ -14,6 +14,7 @@ Exception attributes and their meaning/uses * usermessage: the message that will be passed to user in ErrorDialogs in Qt-land. """ +from leap.util.translations import translate class LeapException(Exception): @@ -22,6 +23,7 @@ class LeapException(Exception): sets some parameters that we will check during error checking routines """ + critical = False failfirst = False warning = False @@ -46,32 +48,50 @@ class ImproperlyConfigured(Exception): pass -class NoDefaultInterfaceFoundError(LeapException): - message = "no default interface found" - usermessage = "Looks like your computer is not connected to the internet" +# NOTE: "Errors" (context) has to be a explicit string! class InterfaceNotFoundError(LeapException): # XXX should take iface arg on init maybe? message = "interface not found" + usermessage = translate( + "Errors", + "Interface not found") + + +class NoDefaultInterfaceFoundError(LeapException): + message = "no default interface found" + usermessage = translate( + "Errors", + "Looks like your computer " + "is not connected to the internet") class NoConnectionToGateway(CriticalError): message = "no connection to gateway" - usermessage = "Looks like there are problems with your internet connection" + usermessage = translate( + "Errors", + "Looks like there are problems " + "with your internet connection") class NoInternetConnection(CriticalError): message = "No Internet connection found" - usermessage = "It looks like there is no internet connection." + usermessage = translate( + "Errors", + "It looks like there is no internet connection.") # and now we try to connect to our web to troubleshoot LOL :P class CannotResolveDomainError(LeapException): message = "Cannot resolve domain" - usermessage = "Domain cannot be found" + usermessage = translate( + "Errors", + "Domain cannot be found") class TunnelNotDefaultRouteError(CriticalError): message = "Tunnel connection dissapeared. VPN down?" - usermessage = "The Encrypted Connection was lost. Shutting down..." + usermessage = translate( + "Errors", + "The Encrypted Connection was lost. Shutting down...") -- cgit v1.2.3 From 1e116fe9453a9010338820394ace05a4f0bcc648 Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 9 Jan 2013 05:40:12 +0900 Subject: dont shut down when conn lost --- src/leap/base/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py index c5e56b76..2e31b33b 100644 --- a/src/leap/base/exceptions.py +++ b/src/leap/base/exceptions.py @@ -90,8 +90,8 @@ class CannotResolveDomainError(LeapException): "Domain cannot be found") -class TunnelNotDefaultRouteError(CriticalError): +class TunnelNotDefaultRouteError(LeapException): message = "Tunnel connection dissapeared. VPN down?" usermessage = translate( "Errors", - "The Encrypted Connection was lost. Shutting down...") + "The Encrypted Connection was lost.") -- cgit v1.2.3