Forráskód Böngészése

Fix catching subscribe/unsubscribe errors

Tulir Asokan 3 éve
szülő
commit
a26576bdc2
1 módosított fájl, 3 hozzáadás és 3 törlés
  1. 3 3
      mausignald/signald.py

+ 3 - 3
mausignald/signald.py

@@ -8,7 +8,7 @@ import asyncio
 
 
 from mautrix.util.logging import TraceLogger
 from mautrix.util.logging import TraceLogger
 
 
-from .errors import UnexpectedError, UnexpectedResponse
+from .errors import RPCError, UnexpectedResponse
 from .rpc import CONNECT_EVENT, DISCONNECT_EVENT, SignaldRPCClient
 from .rpc import CONNECT_EVENT, DISCONNECT_EVENT, SignaldRPCClient
 from .types import (
 from .types import (
     Account,
     Account,
@@ -98,7 +98,7 @@ class SignaldClient(SignaldRPCClient):
             await self.request_v1("subscribe", account=username)
             await self.request_v1("subscribe", account=username)
             self._subscriptions.add(username)
             self._subscriptions.add(username)
             return True
             return True
-        except UnexpectedError as e:
+        except RPCError as e:
             self.log.debug("Failed to subscribe to %s: %s", username, e)
             self.log.debug("Failed to subscribe to %s: %s", username, e)
             evt = WebsocketConnectionStateChangeEvent(
             evt = WebsocketConnectionStateChangeEvent(
                 state=(
                 state=(
@@ -116,7 +116,7 @@ class SignaldClient(SignaldRPCClient):
             await self.request_v1("unsubscribe", account=username)
             await self.request_v1("unsubscribe", account=username)
             self._subscriptions.remove(username)
             self._subscriptions.remove(username)
             return True
             return True
-        except UnexpectedError as e:
+        except RPCError as e:
             self.log.debug("Failed to unsubscribe from %s: %s", username, e)
             self.log.debug("Failed to unsubscribe from %s: %s", username, e)
             return False
             return False