From c2786de7d2d09d600fa516f93cc1a1f851f0d705 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 27 Aug 2012 05:13:29 +0900 Subject: make provider-fetch tests pass test provider-definition dump functions. refactored the set-temp-to-home methods to setUpClass separate provider-fetch tests on different testcases (so they actually call to requests). --- src/leap/base/exceptions.py | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/leap/base/exceptions.py (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py new file mode 100644 index 00000000..93dde385 --- /dev/null +++ b/src/leap/base/exceptions.py @@ -0,0 +1,2 @@ +class MissingConfigFileError(Exception): + pass -- cgit v1.2.3 From 5e77b77765154850fb708e6ea188fcf7ba99fdce Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 30 Aug 2012 04:37:30 +0900 Subject: add test for JSONLeapConfig metaclass --- src/leap/base/exceptions.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py index 93dde385..9c4aa77b 100644 --- a/src/leap/base/exceptions.py +++ b/src/leap/base/exceptions.py @@ -1,2 +1,6 @@ class MissingConfigFileError(Exception): pass + + +class ImproperlyConfigured(Exception): + pass -- cgit v1.2.3 From 15b017656e6865b7b85ae389ab3b462c562a1e42 Mon Sep 17 00:00:00 2001 From: antialias Date: Tue, 25 Sep 2012 16:05:02 -0400 Subject: moved LeapNetworkChecker and test in base. --- src/leap/base/exceptions.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py index 9c4aa77b..7771d1f9 100644 --- a/src/leap/base/exceptions.py +++ b/src/leap/base/exceptions.py @@ -4,3 +4,22 @@ class MissingConfigFileError(Exception): class ImproperlyConfigured(Exception): pass + + +class NoDefaultInterfaceFoundError(Exception): + message = "no default interface found" + usermessage = "Looks like your computer is not connected to the internet" + + +class InterfaceNotFoundError(Exception): + # XXX should take iface arg on init maybe? + message = "interface not found" + + +class NoConnectionToGateway(Exception): + message = "no connection to gateway" + usermessage = "Looks like there are problems with your internet connection" + + +class NoInternetConnection(Exception): + message = "No Internet connection found" -- cgit v1.2.3 From 202345940e12d4633c5d46d5ed21c3a433573d48 Mon Sep 17 00:00:00 2001 From: antialias Date: Fri, 28 Sep 2012 18:15:47 -0400 Subject: Added check that default route is tun0. --- src/leap/base/exceptions.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py index 7771d1f9..48d827f5 100644 --- a/src/leap/base/exceptions.py +++ b/src/leap/base/exceptions.py @@ -23,3 +23,7 @@ class NoConnectionToGateway(Exception): class NoInternetConnection(Exception): message = "No Internet connection found" + + +class TunnelNotDefaultRouteError(Exception): + message = "VPN Maybe be down." -- cgit v1.2.3 From 6728eb9afb21bad867e4052a6190a9bdb34c928a Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 8 Oct 2012 07:50:24 +0900 Subject: popup dialog error when network error happens we are shutting down for now. we should be acting upon failures in the near future. lowered the recurrent checks interval to 10 seconds. --- src/leap/base/exceptions.py | 55 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) (limited to 'src/leap/base/exceptions.py') diff --git a/src/leap/base/exceptions.py b/src/leap/base/exceptions.py index 48d827f5..f12a49d5 100644 --- a/src/leap/base/exceptions.py +++ b/src/leap/base/exceptions.py @@ -1,3 +1,43 @@ +""" +Exception attributes and their meaning/uses +------------------------------------------- + +* critical: if True, will abort execution prematurely, + after attempting any cleaning + action. + +* failfirst: breaks any error_check loop that is examining + the error queue. + +* message: the message that will be used in the __repr__ of the exception. + +* usermessage: the message that will be passed to user in ErrorDialogs + in Qt-land. +""" + + +class LeapException(Exception): + """ + base LeapClient exception + sets some parameters that we will check + during error checking routines + """ + critical = False + failfirst = False + warning = False + + +class CriticalError(LeapException): + """ + we cannot do anything about it + """ + critical = True + failfirst = True + + +# In use ??? +# don't thing so. purge if not... + class MissingConfigFileError(Exception): pass @@ -6,24 +46,27 @@ class ImproperlyConfigured(Exception): pass -class NoDefaultInterfaceFoundError(Exception): +class NoDefaultInterfaceFoundError(LeapException): message = "no default interface found" usermessage = "Looks like your computer is not connected to the internet" -class InterfaceNotFoundError(Exception): +class InterfaceNotFoundError(LeapException): # XXX should take iface arg on init maybe? message = "interface not found" -class NoConnectionToGateway(Exception): +class NoConnectionToGateway(CriticalError): message = "no connection to gateway" usermessage = "Looks like there are problems with your internet connection" -class NoInternetConnection(Exception): +class NoInternetConnection(CriticalError): message = "No Internet connection found" + usermessage = "It looks like there is no internet connection." + # and now we try to connect to our web to troubleshoot LOL :P -class TunnelNotDefaultRouteError(Exception): - message = "VPN Maybe be down." +class TunnelNotDefaultRouteError(CriticalError): + message = "Tunnel connection dissapeared. VPN down?" + usermessage = "The Encrypted Connection was lost. Shutting down..." -- cgit v1.2.3 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