Improve error handling to spare the server log from user's malformed requests and stop trying to parse data from providers if the HTTP status was not 200

This commit is contained in:
Ian Renton
2026-07-25 08:17:17 +01:00
parent 34e3933d5d
commit 2fc9658571
26 changed files with 169 additions and 128 deletions
+3 -3
View File
@@ -74,7 +74,7 @@ class APILookupCallHandler(tornado.web.RequestHandler):
self.set_status(422)
except Exception as e:
logging.error(e)
logging.error("Exception when handling client request to call lookup API: %s", e, exc_info=True)
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
@@ -126,7 +126,7 @@ class APILookupSIGRefHandler(tornado.web.RequestHandler):
self.set_status(422)
except Exception as e:
logging.error(e)
logging.error("Exception when handling client request to sig ref lookup API: %s", e, exc_info=True)
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)
@@ -188,7 +188,7 @@ class APILookupGridHandler(tornado.web.RequestHandler):
self.set_status(422)
except Exception as e:
logging.error(e)
logging.error("Exception when handling client request to grid ref lookup API: %s", e, exc_info=True)
self.write(safe_json_dumps("Error - an internal server error occurred."))
self.set_status(500)