from msgbus import MBMessage


class UnexpectedResponse(Exception):
    def __init__(
        self,     # type: UnexpectedResponse
        service,  # type: str
        message,  # type: MBMessage
    ):
        # type: (...) -> None

        self.service = service
        self.message = message

    def __str__(self):
        # type: () -> str

        return "Unexpected response from {}: {} - {}".format(self.service, self.message.token, self.message.data)

    def __repr__(self):
        # type: () -> str

        return self.__str__()
