mirror of
https://github.com/facefusion/facefusion.git
synced 2026-11-17 07:24:10 +01:00
handle client disconnect
This commit is contained in:
1 parent
d3ad762897
commit
074ea75ccd
1 file changed
+2
-1
@@ -1,5 +1,6 @@
|
||||
from json import JSONDecodeError
|
||||
|
||||
from starlette.requests import ClientDisconnect
|
||||
from starlette.responses import JSONResponse
|
||||
from starlette.status import HTTP_400_BAD_REQUEST
|
||||
from starlette.types import ASGIApp, Receive, Scope, Send
|
||||
@@ -11,7 +12,7 @@ def create_exception_guard(app : ASGIApp) -> ASGIApp:
|
||||
async def middleware(scope : Scope, receive : Receive, send : Send) -> None:
|
||||
try:
|
||||
await app(scope, receive, send)
|
||||
except JSONDecodeError:
|
||||
except (ClientDisconnect, JSONDecodeError):
|
||||
response = JSONResponse(
|
||||
{
|
||||
'message': translator.get('something_went_wrong', 'facefusion.apis')
|
||||
|
||||
Reference in new issue
Block a user