Why there's so many exceptions to catch?
And why there's TimeoutError and asyncio.exceptions.TimeoutError?
This commit is contained in:
parent
0e59717c91
commit
87a74898eb
|
@ -1,3 +1,4 @@
|
||||||
|
from asyncio import exceptions
|
||||||
from json import loads
|
from json import loads
|
||||||
from typing import AsyncGenerator
|
from typing import AsyncGenerator
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -21,6 +22,6 @@ async def websocket_source(
|
||||||
raise Exception(event["error"])
|
raise Exception(event["error"])
|
||||||
if event["event"] == "update":
|
if event["event"] == "update":
|
||||||
yield Status.from_dict(loads(event["payload"]))
|
yield Status.from_dict(loads(event["payload"]))
|
||||||
except (WebSocketException, TimeoutError):
|
except (WebSocketException, TimeoutError, exceptions.TimeoutError):
|
||||||
if not reconnect:
|
if not reconnect:
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in New Issue