Skip to content

check_msg_error

faststream.confluent.client.check_msg_error #

check_msg_error(msg: Optional[Message]) -> Optional[Message]

Checks for errors in the consumed message.

PARAMETER DESCRIPTION
msg

The message to check for errors.

TYPE: Message

RETURNS DESCRIPTION
Message

The original message if no error is found, otherwise None.

TYPE: Optional[Message]

Source code in faststream/confluent/client.py
def check_msg_error(msg: Optional[Message]) -> Optional[Message]:
    """Checks for errors in the consumed message.

    Args:
        msg (Message): The message to check for errors.

    Returns:
        Message: The original message if no error is found, otherwise None.
    """
    if msg is None:
        return msg
    if msg.error():
        return None
    return msg