Class InvalidPayloadException

All Implemented Interfaces:
Serializable

public class InvalidPayloadException extends CamelExchangeException
Thrown when the body of a Message cannot be converted to the expected type, for example because the body is null or its runtime type is incompatible with the requested type.

This is the checked variant; for the unchecked equivalent see InvalidPayloadRuntimeException.

See Also:
  • Constructor Details

    • InvalidPayloadException

      public InvalidPayloadException(Exchange exchange, Class<?> type)
      Parameters:
      exchange - the exchange that caused the error
      type - the expected body type
    • InvalidPayloadException

      public InvalidPayloadException(Exchange exchange, Class<?> type, Message message)
      Parameters:
      exchange - the exchange that caused the error
      type - the expected body type
      message - the message with the invalid or missing payload
    • InvalidPayloadException

      public InvalidPayloadException(Exchange exchange, Class<?> type, Message message, Throwable cause)
      Parameters:
      exchange - the exchange that caused the error
      type - the expected body type
      message - the message with the invalid or missing payload
      cause - the cause of the failure
  • Method Details

    • getType

      public @Nullable Class<?> getType()
      The expected type of the body