From 943fd5723cb4fd9a916b8baa6858c5895e8172cb Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 14 Feb 2022 13:48:15 +0100 Subject: Python: Move error class to a separate file Signed-off-by: jwijenbergh --- wrappers/python/eduvpncommon/discovery.py | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'wrappers/python/eduvpncommon/discovery.py') 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. -- cgit v1.2.3