Class SpringAIErrorMapper

java.lang.Object
com.google.adk.models.springai.error.SpringAIErrorMapper

public class SpringAIErrorMapper extends Object
Maps Spring AI exceptions to appropriate ADK exceptions and error handling strategies.

This class provides:

  • Exception classification and mapping
  • Retry strategy recommendations
  • Error message normalization
  • Rate limiting detection
  • Constructor Details

    • SpringAIErrorMapper

      public SpringAIErrorMapper()
  • Method Details

    • mapError

      public static SpringAIErrorMapper.MappedError mapError(Throwable exception)
      Maps a Spring AI exception to an error category and retry strategy.
      Parameters:
      exception - the Spring AI exception
      Returns:
      mapped error information
    • isRetryable

      public static boolean isRetryable(SpringAIErrorMapper.ErrorCategory category)
      Determines if an error is retryable based on its category.
      Parameters:
      category - the error category
      Returns:
      true if the error is potentially retryable
    • getRetryDelay

      public static long getRetryDelay(SpringAIErrorMapper.RetryStrategy strategy, int attempt)
      Gets the recommended delay before retrying based on the retry strategy.
      Parameters:
      strategy - the retry strategy
      attempt - the retry attempt number (0-based)
      Returns:
      delay in milliseconds