def _process_connection_error(policy, condition, description=None, info=None): try: amqp_condition = constants.ErrorCodes(condition) except ValueError: exception = VendorConnectionClose(condition, description, info) exception.action = policy.on_unrecognized_error(exception) else: exception = ConnectionClose(amqp_condition, description, info) exception.action = policy.on_connection_error(exception) return exception
def _process_send_error(policy, condition, description=None, info=None): try: amqp_condition = constants.ErrorCodes(condition) except ValueError: exception = MessageException(condition, description, info) exception.action = policy.on_unrecognized_error(exception) else: exception = MessageSendFailed(amqp_condition, description, info) exception.action = policy.on_message_error(exception) return exception
def _process_link_error(policy, condition, description=None, info=None): try: amqp_condition = constants.ErrorCodes(condition) except ValueError: exception = VendorLinkDetach(condition, description, info) exception.action = policy.on_unrecognized_error(exception) else: if amqp_condition == constants.ErrorCodes.LinkRedirect: exception = LinkRedirect(amqp_condition, description, info) else: exception = LinkDetach(amqp_condition, description, info) exception.action = policy.on_link_error(exception) return exception