Source code for zonis.exceptions

[docs]class BaseZonisException(Exception): """A base exception handler for Zonis.""" def __init__(self, *args): if args: self.message = args[0] else: self.message = self.__doc__ def __str__(self): return self.message
[docs]class MissingReceiveHandler(BaseZonisException): """Cannot handle incoming requests due to a lack of receive handlers."""
[docs]class DuplicateConnection(BaseZonisException): """You have attempted to connect with a duplicated identifier. Please try again with a unique one or provide the correct override key."""
[docs]class DuplicateRoute(BaseZonisException): """You are attempting to register multiple routes with the same name. Consider setting the route_name argument to something unique."""
[docs]class UnhandledWebsocketType(BaseZonisException): """Found a websocket type we can't handle."""
[docs]class UnknownRoute(BaseZonisException): """The route you requested does not exist."""
[docs]class UnknownClient(BaseZonisException): """The client you requested is not currently connected."""
[docs]class UnknownPacket(BaseZonisException): """Router received a packet without a known handler."""
[docs]class RequestFailed(BaseZonisException): """This request resulted in an error on the end client.""" def __init__(self, data): super().__init__() self.response_data = data def __str__(self): return self.message + "\n\n" + self.response_data