From 8d416d763399855c334ab324ff34b40b0e98d47c Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Mon, 22 Jan 2024 14:44:21 -0500 Subject: [PATCH] allnet: add exception handling if get_allnet_info fails --- core/allnet.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/allnet.py b/core/allnet.py index 0cfacf5..d9ac895 100644 --- a/core/allnet.py +++ b/core/allnet.py @@ -263,7 +263,13 @@ class AllnetServlet: int_ver = req.ver.replace(".", "") - resp.uri, resp.host = TitleServlet.title_registry[req.game_id].get_allnet_info(req.game_id, int(int_ver), req.serial) + try: + resp.uri, resp.host = TitleServlet.title_registry[req.game_id].get_allnet_info(req.game_id, int(int_ver), req.serial) + except Exception as e: + self.logger.error(f"Error running get_allnet_info for {req.game_id} - {e}") + resp.stat = ALLNET_STAT.bad_game.value + resp_dict = {k: v for k, v in vars(resp).items() if v is not None} + return PlainTextResponse(urllib.parse.unquote(urllib.parse.urlencode(resp_dict)) + "\n") msg = f"{req.serial} authenticated from {request_ip}: {req.game_id} v{req.ver}" await self.data.base.log_event("allnet", "ALLNET_AUTH_SUCCESS", logging.INFO, msg)