class SendFail(BaseException):
- pass
+ 'When Client.send fails.'
+
+
+class ImplementationFail(BaseException):
+ 'When no matching parser found for server message.'
class AutoAttrMixin:
ret = result
break
if '_verb' not in ret:
- self._log(f'PLEASE IMPLEMENT HANDLER FOR: {msg.raw}', alert=True)
- return
+ raise ImplementationFail(f'No handler implemented for: {msg.raw}')
for n_u_h in ret['_nickuserhosts']: # update, turn into proper users
if (id_ := self.db.users.id_for_nickuserhost(
n_u_h, allow_none=True, updating=True)):
CMD_SHORTCUTS)
from ircplom.client import (
AutoAttrMixin, Channel, Client, ClientQueueMixin, Dict, DictItem,
- IrcConnSetup, LogScope, NewClientEvent, NickUserHost, SendFail,
- ServerCapability, SharedClientDbFields, User)
+ ImplementationFail, IrcConnSetup, LogScope, NewClientEvent,
+ NickUserHost, SendFail, ServerCapability, SharedClientDbFields, User)
from ircplom.irc_conn import IrcMessage
CMD_SHORTCUTS['disconnect'] = 'window.disconnect'
def handle_msg(self, msg: IrcMessage) -> None:
self._log(msg.raw, scope=LogScope.RAW, out=False)
- super().handle_msg(msg)
+ try:
+ super().handle_msg(msg)
+ except ImplementationFail as e:
+ self._log(str(e), scope=LogScope.DEBUG, alert=True)
def _log(self, msg: str, scope: Optional[LogScope] = None, **kwargs
) -> None: