core: improve error handling on ASGI level (#10547)
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -274,9 +274,13 @@ class ChannelsLoggingMiddleware:
|
||||
self.log(scope)
|
||||
try:
|
||||
return await self.inner(scope, receive, send)
|
||||
except DenyConnection:
|
||||
return await send({"type": "websocket.close"})
|
||||
except Exception as exc:
|
||||
if settings.DEBUG:
|
||||
raise exc
|
||||
LOGGER.warning("Exception in ASGI application", exc=exc)
|
||||
raise DenyConnection() from None
|
||||
return await send({"type": "websocket.close"})
|
||||
|
||||
def log(self, scope: dict, **kwargs):
|
||||
"""Log request"""
|
||||
|
||||
Reference in New Issue
Block a user