summaryrefslogtreecommitdiff
path: root/wrappers/python/eduvpncommon/error.py
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-02-14 14:11:29 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-05 12:26:12 +0200
commit0f5ae9a05b71545f34acde15f50536ff80da4ac0 (patch)
tree280b607a4e991327a6ad4c29863cd5e38b83bb28 /wrappers/python/eduvpncommon/error.py
parent943fd5723cb4fd9a916b8baa6858c5895e8172cb (diff)
Python: Simplify error class
Signed-off-by: jwijenbergh <jeroenwijenbergh@protonmail.com>
Diffstat (limited to 'wrappers/python/eduvpncommon/error.py')
-rw-r--r--wrappers/python/eduvpncommon/error.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/wrappers/python/eduvpncommon/error.py b/wrappers/python/eduvpncommon/error.py
index 2ec82e7..ce0cec1 100644
--- a/wrappers/python/eduvpncommon/error.py
+++ b/wrappers/python/eduvpncommon/error.py
@@ -2,15 +2,12 @@ from enum import Enum
class GoError(Exception):
message_dict: dict
- code: Enum | None
+ code: Enum
def __init__(self, err: Enum, messages: dict):
assert err
- try:
- self.code = err
- except ValueError:
- self.code = None
+ self.code = err
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})"
+ return self.message_dict[self.code]