summaryrefslogtreecommitdiff
path: root/wrappers/python/eduvpncommon/discovery.py
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-02-14 13:48:15 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-05 12:26:12 +0200
commit943fd5723cb4fd9a916b8baa6858c5895e8172cb (patch)
treefc9ebd50d0e467604e90de921e3856404462a87b /wrappers/python/eduvpncommon/discovery.py
parentc961faa8d7ba02e601586c3ce531b2329c7b258e (diff)
Python: Move error class to a separate file
Signed-off-by: jwijenbergh <jeroenwijenbergh@protonmail.com>
Diffstat (limited to 'wrappers/python/eduvpncommon/discovery.py')
-rw-r--r--wrappers/python/eduvpncommon/discovery.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/wrappers/python/eduvpncommon/discovery.py b/wrappers/python/eduvpncommon/discovery.py
index 8559eb1..b30368b 100644
--- a/wrappers/python/eduvpncommon/discovery.py
+++ b/wrappers/python/eduvpncommon/discovery.py
@@ -1,4 +1,5 @@
from . import lib, GoSlice, DataError
+from .error import GoError
from ctypes import *
from typing import Callable
from enum import Enum
@@ -31,22 +32,6 @@ def GetServersList() -> str:
return getList(lib.GetServersList)
-class GoError(Exception):
- message_dict: dict
- code: Enum | None
-
- def __init__(self, err: Enum, messages: dict):
- assert err
- try:
- self.code = err
- except ValueError:
- self.code = None
- self.message_dict = messages
-
- def __str__(self):
- return self.message_dict[self.code] if self.code in self.message_dict else f"unknown error ({self.code})"
-
-
class RequestErrorCode(Enum):
ErrRequestFileError = 1 # The request for the file has failed.
ErrVerifySigError = 2 # The signature failed to verify.