Class MessageConversionException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.google.adk.models.springai.MessageConversionException
All Implemented Interfaces:
Serializable

public class MessageConversionException extends RuntimeException
Exception thrown when message conversion between ADK and Spring AI formats fails.

This exception is thrown when there are issues converting between ADK's Content/Part format and Spring AI's Message/ChatResponse format, such as JSON parsing errors, invalid message structures, or unsupported content types.

See Also:
  • Constructor Details

    • MessageConversionException

      public MessageConversionException(String message)
      Constructs a new MessageConversionException with the specified detail message.
      Parameters:
      message - the detail message
    • MessageConversionException

      public MessageConversionException(String message, Throwable cause)
      Constructs a new MessageConversionException with the specified detail message and cause.
      Parameters:
      message - the detail message
      cause - the cause of the exception
    • MessageConversionException

      public MessageConversionException(Throwable cause)
      Constructs a new MessageConversionException with the specified cause.
      Parameters:
      cause - the cause of the exception
  • Method Details

    • jsonParsingFailed

      public static MessageConversionException jsonParsingFailed(String context, Throwable cause)
      Creates a MessageConversionException for JSON parsing failures.
      Parameters:
      context - the context where the parsing failed (e.g., "tool call arguments")
      cause - the underlying JSON processing exception
      Returns:
      a new MessageConversionException with appropriate message
    • invalidMessageStructure

      public static MessageConversionException invalidMessageStructure(String message)
      Creates a MessageConversionException for invalid message structure.
      Parameters:
      message - description of the invalid structure
      Returns:
      a new MessageConversionException
    • unsupportedContentType

      public static MessageConversionException unsupportedContentType(String contentType)
      Creates a MessageConversionException for unsupported content type.
      Parameters:
      contentType - the unsupported content type
      Returns:
      a new MessageConversionException