From: Michael Tremer Date: Thu, 19 Oct 2023 20:43:15 +0000 (+0000) Subject: web: Make APIError inherit from HTTPError X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ce7277af9bd6cd363f77680edbf10c596c5bb986;p=pbs.git web: Make APIError inherit from HTTPError This way, tornado will catch the exception and log something useful Signed-off-by: Michael Tremer --- diff --git a/src/web/base.py b/src/web/base.py index 6ec2fa9b..bdbe2214 100644 --- a/src/web/base.py +++ b/src/web/base.py @@ -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