]> git.ipfire.org Git - pbs.git/commitdiff
web: Make APIError inherit from HTTPError
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 19 Oct 2023 20:43:15 +0000 (20:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 19 Oct 2023 20:43:15 +0000 (20:43 +0000)
This way, tornado will catch the exception and log something useful

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/web/base.py

index 6ec2fa9b9037aa02bef66e96849a33639a27c83f..bdbe2214a05deb75550b9463a7860da115ce6c30 100644 (file)
@@ -310,12 +310,12 @@ class BaseHandler(tornado.web.RequestHandler):
 # XXX TODO
 BackendMixin = BaseHandler
 
-class APIError(Exception):
+class APIError(tornado.web.HTTPError):
        """
                Raised if there has been an error in the API
        """
        def __init__(self, code, message):
-               super().__init__()
+               super().__init__(400, message)
 
                self.code = code
                self.message = message