fix exception
This commit is contained in:
parent
1407719f2f
commit
3a90b07235
1 changed files with 2 additions and 0 deletions
|
|
@ -61,6 +61,8 @@ async def chat(
|
||||||
await websocket.close(code=status.WS_1011_INTERNAL_ERROR, reason=str(exc))
|
await websocket.close(code=status.WS_1011_INTERNAL_ERROR, reason=str(exc))
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
logger.error(f"Error in chat websocket: {exc}")
|
logger.error(f"Error in chat websocket: {exc}")
|
||||||
|
if isinstance(exc, HTTPException):
|
||||||
|
exc = exc.detail
|
||||||
if "Could not validate credentials" in str(exc):
|
if "Could not validate credentials" in str(exc):
|
||||||
await websocket.close(
|
await websocket.close(
|
||||||
code=status.WS_1008_POLICY_VIOLATION, reason="Unauthorized"
|
code=status.WS_1008_POLICY_VIOLATION, reason="Unauthorized"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue