1
0
Fork 0

Why there's so many exceptions to catch?

And why there's TimeoutError and asyncio.exceptions.TimeoutError?
This commit is contained in:
Casey 2022-08-31 12:34:25 +03:00
parent 0e59717c91
commit 87a74898eb
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 2 additions and 1 deletions

View File

@ -1,3 +1,4 @@
from asyncio import exceptions
from json import loads
from typing import AsyncGenerator
from urllib.parse import urlencode
@ -21,6 +22,6 @@ async def websocket_source(
raise Exception(event["error"])
if event["event"] == "update":
yield Status.from_dict(loads(event["payload"]))
except (WebSocketException, TimeoutError):
except (WebSocketException, TimeoutError, exceptions.TimeoutError):
if not reconnect:
raise