From ce7277af9bd6cd363f77680edbf10c596c5bb986 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 19 Oct 2023 20:43:15 +0000 Subject: [PATCH] web: Make APIError inherit from HTTPError This way, tornado will catch the exception and log something useful Signed-off-by: Michael Tremer --- src/web/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.47.3