refactor: replace try-except blocks with contextlib.suppress for cleaner error handling across multiple files

This commit is contained in:
Jack Lu
2026-05-01 19:30:11 +08:00
committed by Xubin Ren
parent 1c24f10236
commit d9800ecdd2
27 changed files with 98 additions and 195 deletions
+2 -3
View File
@@ -3,6 +3,7 @@
from __future__ import annotations
import asyncio
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING, Any
@@ -220,10 +221,8 @@ class ChannelManager:
# Stop dispatcher
if self._dispatch_task:
self._dispatch_task.cancel()
try:
with suppress(asyncio.CancelledError):
await self._dispatch_task
except asyncio.CancelledError:
pass
# Stop all channels
for name, channel in self.channels.items():