From 87a74898eb85fd6dde7a106684d1da7cfb6519b6 Mon Sep 17 00:00:00 2001 From: hkc Date: Wed, 31 Aug 2022 12:34:25 +0300 Subject: [PATCH] Why there's so many exceptions to catch? And why there's TimeoutError and asyncio.exceptions.TimeoutError? --- mastoposter/sources.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mastoposter/sources.py b/mastoposter/sources.py index 9af446a..e2bdbb9 100644 --- a/mastoposter/sources.py +++ b/mastoposter/sources.py @@ -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