Properly catch 404 on deleted invite

Otherwise, this gives a nasty 500. A proper fix would be to flash
a message and return to the invite list, but that’s more complex
and will be tracked in #40.
This commit is contained in:
Jonas Schäfer
2021-01-30 12:44:30 +01:00
parent 8a010cf3a3
commit ba3440b169

View File

@@ -251,7 +251,11 @@ async def create_invite() -> typing.Union[str, quart.Response]:
@bp.route("/invitation/<id_>", methods=["GET", "POST"])
@client.require_admin_session()
async def edit_invite(id_: str) -> typing.Union[str, quart.Response]:
invite_info = await client.get_invite_by_id(id_)
try:
invite_info = await client.get_invite_by_id(id_)
except aiohttp.ClientResponseError as exc:
if exc.status == 404:
abort(404)
circles = await client.list_groups()
circle_map = {
circle.id_: circle