summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-12-01 18:58:10 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-12-01 18:58:10 +0100
commit9b83579ad19e3f9e59e88c38c92552ba8370a20c (patch)
treed99aeea8f33100dbc38ffa9f15af671464d3d6a2
parent1434e74ea0d943ed824afce49ac0afc4b47aa59c (diff)
fix(clients): make FlipdotGschichtlerError behave like a proper Exception
-rw-r--r--clients/py/flipdot_gschichtler/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/clients/py/flipdot_gschichtler/__init__.py b/clients/py/flipdot_gschichtler/__init__.py
index b78663f..06ee443 100644
--- a/clients/py/flipdot_gschichtler/__init__.py
+++ b/clients/py/flipdot_gschichtler/__init__.py
@@ -4,10 +4,17 @@ import requests
 class FlipdotGschichtlerError(Exception):
     """Error from the REST API"""
     def __init__(self, endpoint, status, message):
+        # make this a proper exception
+        super().__init__(message)
+
         self.endpoint = endpoint
         self.status = status
         self.message = message
 
+    def __str__(self):
+        return "Endpoint {} returned {} with message \"{}\"".format(
+            self.endpoint, str(self.status), self.message)
+
 class FlipdotGschichtlerClient():
     def __init__(self, base_url, api_token = None):
         self.base_url = base_url