error_map: default to 500

This commit is contained in:
Guilhem Saurel 2023-04-08 15:11:07 +02:00
parent e96a58c44d
commit 2a8ab12caa

View File

@ -1,6 +1,7 @@
"""Matrix Webhook utils."""
import logging
from collections import defaultdict
from http import HTTPStatus
from aiohttp import web
@ -10,10 +11,13 @@ from nio.responses import JoinError, RoomSendError
from . import conf
ERROR_MAP = {
"M_FORBIDDEN": HTTPStatus.FORBIDDEN,
"M_CONSENT_NOT_GIVEN": HTTPStatus.FORBIDDEN,
}
ERROR_MAP = defaultdict(
lambda: HTTPStatus.INTERNAL_SERVER_ERROR,
{
"M_FORBIDDEN": HTTPStatus.FORBIDDEN,
"M_CONSENT_NOT_GIVEN": HTTPStatus.FORBIDDEN,
},
)
LOGGER = logging.getLogger("matrix_webhook.utils")
CLIENT = AsyncClient(conf.MATRIX_URL, conf.MATRIX_ID)