Catch exception when inbound websocket data is not JSON

このコミットが含まれているのは:
n9k 2022-02-22 11:43:36 +00:00
コミット 9204669a7f
1個のファイルの変更7行の追加2行の削除

ファイルの表示

@ -1,4 +1,5 @@
import asyncio
import json
from quart import current_app, websocket
@ -33,8 +34,12 @@ async def websocket_outbound(queue, user):
async def websocket_inbound(queue, user):
while True:
receipt = await websocket.receive_json()
see(user)
try:
receipt = await websocket.receive_json()
except json.JSONDecodeError:
receipt = None
finally:
see(user)
try:
nonce, comment, digest, answer = parse_websocket_data(receipt)
except Malformed as e: