Loading kilter/protocol/core.py +1 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ class FilterProtocol: if message.ident in UPDATE_RESPONSES and isinstance(event, messages.EndOfMessage): return if message.ident not in responses: raise InvalidMessage(event, message) raise InvalidMessage(message, event) self.state = None def _store_mta_flags(self, message: messages.Negotiate) -> None: Loading kilter/protocol/exceptions.py +9 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,9 @@ Exceptions raised by the package from typing import TYPE_CHECKING if TYPE_CHECKING: from .messages import Message __all__ = [ "InsufficientSpace", "NeedsMore", "UnexpectedMessage", "InvalidMessage", "UnknownMessage", Loading Loading @@ -58,6 +61,9 @@ class UnexpectedMessage(TypeError): Raised by a protocol to indicate a message that is not expected in the current state """ if TYPE_CHECKING: def __init__(self, message: Message): ... def __str__(self) -> str: return f"message was not expected by the protocol: {self.args[0]}" Loading @@ -66,3 +72,6 @@ class InvalidMessage(UnexpectedMessage): """ Raised by a protocol to indicate a message that is unknown to the state machine """ if TYPE_CHECKING: def __init__(self, message: Message, event: Message|None = None): ... Loading
kilter/protocol/core.py +1 −1 Original line number Diff line number Diff line Loading @@ -271,7 +271,7 @@ class FilterProtocol: if message.ident in UPDATE_RESPONSES and isinstance(event, messages.EndOfMessage): return if message.ident not in responses: raise InvalidMessage(event, message) raise InvalidMessage(message, event) self.state = None def _store_mta_flags(self, message: messages.Negotiate) -> None: Loading
kilter/protocol/exceptions.py +9 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,9 @@ Exceptions raised by the package from typing import TYPE_CHECKING if TYPE_CHECKING: from .messages import Message __all__ = [ "InsufficientSpace", "NeedsMore", "UnexpectedMessage", "InvalidMessage", "UnknownMessage", Loading Loading @@ -58,6 +61,9 @@ class UnexpectedMessage(TypeError): Raised by a protocol to indicate a message that is not expected in the current state """ if TYPE_CHECKING: def __init__(self, message: Message): ... def __str__(self) -> str: return f"message was not expected by the protocol: {self.args[0]}" Loading @@ -66,3 +72,6 @@ class InvalidMessage(UnexpectedMessage): """ Raised by a protocol to indicate a message that is unknown to the state machine """ if TYPE_CHECKING: def __init__(self, message: Message, event: Message|None = None): ...