diff --git a/houdini/handlers/__init__.py b/houdini/handlers/__init__.py index a0645ba..8fa0626 100644 --- a/houdini/handlers/__init__.py +++ b/houdini/handlers/__init__.py @@ -13,6 +13,10 @@ class AuthorityError(Exception): """Raised when a packet is received but user has not yet authenticated""" +class AbortHandlerChain(Exception): + """Exception raised when handler wants to abort the rest of the handler chain""" + + class _Packet: __slots__ = ['id'] diff --git a/houdini/spheniscidae.py b/houdini/spheniscidae.py index 97d26c0..2e2240c 100644 --- a/houdini/spheniscidae.py +++ b/houdini/spheniscidae.py @@ -4,7 +4,7 @@ from xml.etree.cElementTree import Element, SubElement, tostring import defusedxml.cElementTree as Et from houdini.constants import ClientType -from houdini.handlers import AuthorityError, XMLPacket, XTPacket +from houdini.handlers import AuthorityError, AbortHandlerChain, XMLPacket, XTPacket class Spheniscidae: @@ -161,6 +161,8 @@ class Spheniscidae: await self.__handle_xt_data(data) except AuthorityError: self.logger.debug(f'{self} tried to send game packet before authentication') + except AbortHandlerChain as e: + self.logger.info(f'Handler chain aborted: {str(e)}') async def run(self): await self._client_connected()