fix: correct exception case for invalid formatter module
This commit is contained in:
parent
0d92c378c4
commit
1ea47991e4
1 changed files with 1 additions and 1 deletions
|
@ -43,7 +43,7 @@ async def matrix_webhook(request):
|
||||||
format = request.rel_url.query["formatter"]
|
format = request.rel_url.query["formatter"]
|
||||||
plugin = importlib.import_module(f"matrix_webhook.formatters.{format}", "formatter")
|
plugin = importlib.import_module(f"matrix_webhook.formatters.{format}", "formatter")
|
||||||
data = plugin.formatter(data, request.headers)
|
data = plugin.formatter(data, request.headers)
|
||||||
except AttributeError:
|
except ModuleNotFoundError:
|
||||||
return utils.create_json_response(
|
return utils.create_json_response(
|
||||||
HTTPStatus.BAD_REQUEST, "Unknown formatter"
|
HTTPStatus.BAD_REQUEST, "Unknown formatter"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue