diff options
-rw-r--r-- | src/leap/eip/conductor.py | 36 | ||||
-rw-r--r-- | src/leap/eip/eipconnection.py | 5 | ||||
-rw-r--r-- | src/leap/eip/exceptions.py | 31 |
3 files changed, 35 insertions, 37 deletions
diff --git a/src/leap/eip/conductor.py b/src/leap/eip/conductor.py index 776a1092..f528d639 100644 --- a/src/leap/eip/conductor.py +++ b/src/leap/eip/conductor.py @@ -26,44 +26,10 @@ from leap.eip.vpnmanager import OpenVPNManager, ConnectionRefusedError logger = logging.getLogger(name=__name__) -# TODO Move exceptions to their own module -# eip.exceptions - -class EIPNoCommandError(Exception): - pass - - -class ConnectionError(Exception): - """ - generic connection error - """ - pass - - -class EIPClientError(Exception): - """ - base EIPClient exception - """ - def __str__(self): - if len(self.args) >= 1: - return repr(self.args[0]) - else: - return ConnectionError - - -class UnrecoverableError(EIPClientError): - """ - we cannot do anything about it, sorry - """ - # XXX we should catch this and raise - # to qtland, so we emit signal - # to translate whatever kind of error - # to user-friendly msg in dialog. - pass - # # Openvpn related classes # +# XXX deprecated! moved to eipconnection class OpenVPNConnection(object): diff --git a/src/leap/eip/eipconnection.py b/src/leap/eip/eipconnection.py index a0fdd77d..7e6c4038 100644 --- a/src/leap/eip/eipconnection.py +++ b/src/leap/eip/eipconnection.py @@ -6,9 +6,10 @@ import logging logger = logging.getLogger(name=__name__) +from leap.base.connection import ConnectionError +from leap.eip import exceptions as eip_exceptions from leap.eip.openvpnconnection import ( OpenVPNConnection, ConnectionRefusedError) -from leap.base.connection import ConnectionError class EIPConnection(OpenVPNConnection): @@ -112,7 +113,7 @@ class EIPConnection(OpenVPNConnection): #conn_result = ConState.DISCONNECTED try: conn_result = self._try_connection() - except UnrecoverableError as except_msg: + except eip_exceptions.UnrecoverableError as except_msg: logger.error("FATAL: %s" % unicode(except_msg)) conn_result = self.status.UNRECOVERABLE except Exception as except_msg: diff --git a/src/leap/eip/exceptions.py b/src/leap/eip/exceptions.py new file mode 100644 index 00000000..bd6489ce --- /dev/null +++ b/src/leap/eip/exceptions.py @@ -0,0 +1,31 @@ +class EIPNoCommandError(Exception): + pass + + +class ConnectionError(Exception): + """ + generic connection error + """ + pass + + +class EIPClientError(Exception): + """ + base EIPClient exception + """ + def __str__(self): + if len(self.args) >= 1: + return repr(self.args[0]) + else: + return ConnectionError + + +class UnrecoverableError(EIPClientError): + """ + we cannot do anything about it, sorry + """ + # XXX we should catch this and raise + # to qtland, so we emit signal + # to translate whatever kind of error + # to user-friendly msg in dialog. + pass |