diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-02-28 11:57:50 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2023-02-28 11:57:50 +0100 |
| commit | b38d6475ea82754d9d3b6e49a00decad04beb310 (patch) | |
| tree | 381cafad34aa2e10e2e8c4204c130c1e54a30de5 /wrappers/python/eduvpn_common | |
| parent | 0cef468252e25f409a435fa0da95ae7faf4698c1 (diff) | |
Refactor: Remove error level
Not useful enought just yet
Diffstat (limited to 'wrappers/python/eduvpn_common')
| -rw-r--r-- | wrappers/python/eduvpn_common/error.py | 12 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/types.py | 5 |
2 files changed, 3 insertions, 14 deletions
diff --git a/wrappers/python/eduvpn_common/error.py b/wrappers/python/eduvpn_common/error.py index 626d9a2..a642a70 100644 --- a/wrappers/python/eduvpn_common/error.py +++ b/wrappers/python/eduvpn_common/error.py @@ -1,23 +1,13 @@ from enum import Enum -class ErrorLevel(Enum): - """The error level enum""" - ERR_OTHER = 0 - ERR_INFO = 1 - ERR_WARNING = 2 - ERR_FATAL = 3 - - class WrappedError(Exception): """An exception returned by the Go library :param: traceback: str: The traceback of the error including newlines :param: cause: str: The cause of the error as a message - :param: level: ErrorLevel: The level of the error """ - def __init__(self, traceback: str, cause: str, level: ErrorLevel): + def __init__(self, traceback: str, cause: str): super(WrappedError, self).__init__(cause) self.traceback = traceback self.cause = cause - self.level = level diff --git a/wrappers/python/eduvpn_common/types.py b/wrappers/python/eduvpn_common/types.py index e4f8e26..c1d9848 100644 --- a/wrappers/python/eduvpn_common/types.py +++ b/wrappers/python/eduvpn_common/types.py @@ -13,7 +13,7 @@ from ctypes import ( ) from typing import Any, Callable, Iterator, List, Optional, Tuple -from eduvpn_common.error import ErrorLevel, WrappedError +from eduvpn_common.error import WrappedError class cToken(Structure): """The C type that represents the Token as forwarded to the Go library @@ -40,7 +40,6 @@ class cError(Structure): :meta private: """ _fields_ = [ - ("level", c_int), ("traceback", c_char_p), ("cause", c_char_p), ] @@ -273,7 +272,7 @@ def get_error(lib: CDLL, ptr: c_void_p) -> Optional[WrappedError]: return None err = cast(ptr, POINTER(cError)).contents wrapped = WrappedError( - err.traceback.decode("utf-8"), err.cause.decode("utf-8"), ErrorLevel(err.level) + err.traceback.decode("utf-8"), err.cause.decode("utf-8") ) lib.FreeError(ptr) return wrapped |
