Catch exception when inbound websocket data is not JSON
このコミットが含まれているのは:
コミット
9204669a7f
|
@ -1,4 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import json
|
||||||
|
|
||||||
from quart import current_app, websocket
|
from quart import current_app, websocket
|
||||||
|
|
||||||
|
@ -33,8 +34,12 @@ async def websocket_outbound(queue, user):
|
||||||
|
|
||||||
async def websocket_inbound(queue, user):
|
async def websocket_inbound(queue, user):
|
||||||
while True:
|
while True:
|
||||||
receipt = await websocket.receive_json()
|
try:
|
||||||
see(user)
|
receipt = await websocket.receive_json()
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
receipt = None
|
||||||
|
finally:
|
||||||
|
see(user)
|
||||||
try:
|
try:
|
||||||
nonce, comment, digest, answer = parse_websocket_data(receipt)
|
nonce, comment, digest, answer = parse_websocket_data(receipt)
|
||||||
except Malformed as e:
|
except Malformed as e:
|
||||||
|
|
読み込み中…
新しいイシューから参照