From 1ea47991e47ea5c4050df41bdd4cd1c2e11397c6 Mon Sep 17 00:00:00 2001 From: Alex Kelly Date: Wed, 3 Nov 2021 17:05:45 -0400 Subject: [PATCH] fix: correct exception case for invalid formatter module --- matrix_webhook/handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matrix_webhook/handler.py b/matrix_webhook/handler.py index fbf94e1..e6f9c38 100644 --- a/matrix_webhook/handler.py +++ b/matrix_webhook/handler.py @@ -43,7 +43,7 @@ async def matrix_webhook(request): format = request.rel_url.query["formatter"] plugin = importlib.import_module(f"matrix_webhook.formatters.{format}", "formatter") data = plugin.formatter(data, request.headers) - except AttributeError: + except ModuleNotFoundError: return utils.create_json_response( HTTPStatus.BAD_REQUEST, "Unknown formatter" )