Skip to content

Commit

Permalink
fix: raise exception instead of returning it
Browse files Browse the repository at this point in the history
as it was deprecated by `aiohttp` (aio-libs/aiohttp#2415)
  • Loading branch information
janbritz committed Jan 15, 2025
1 parent b8b9180 commit 43a429c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions questionpy_server/web/_middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ async def error_middleware(request: Request, handler: Handler) -> StreamResponse
"""
try:
return await handler(request)
except web.HTTPException as e:
return e
except web.HTTPException:
raise
except tuple(exception_map.keys()) as e:
exception = exception_map[type(e)]
return exception(reason=e.reason, temporary=e.temporary)
except Exception: # noqa: BLE001
raise exception(reason=e.reason, temporary=e.temporary) from e
except Exception as e:
web_logger.exception("There was an unexpected error while processing the request.")
return web_error.ServerError(reason="unknown", temporary=True)
raise web_error.ServerError(reason="unknown", temporary=True) from e


middlewares: Iterable[Middleware] = {error_middleware}

0 comments on commit 43a429c

Please sign in to comment.