类:SpringAIErrorMapper
java.lang.Object
com.google.adk.models.springai.error.SpringAIErrorMapper
将 Spring AI 抛出的异常映射到相应的 ADK 异常,并采用相应的错误处理策略。
该类提供了以下功能:
- 异常分类与映射
- 关于重试策略的建议
- 错误信息的标准化处理
- 速率限制检测(Rate Limiting Detection)
-
嵌套类概述
Nested ClassesModifier and TypeClassDescriptionstatic enum不同类型故障的错误分类。static class用于存储映射错误信息的容器。static enum关于重试策略的建议。 -
构造函数概述
Constructors -
方法概述
Modifier and TypeMethodDescriptionstatic longgetRetryDelay(SpringAIErrorMapper.RetryStrategy strategy, int attempt) 根据重试策略,获取建议的重试前等待时间(即延迟时间)。static booleanisRetryable(SpringAIErrorMapper.ErrorCategory category) 根据错误的类别来判断该错误是否可以重试。将 Spring AI 异常映射到相应的错误类别和重试策略。
-
构造函数详细信息
-
SpringAIErrorMapper
public SpringAIErrorMapper()
-
-
方法详细信息(Method Details)
-
mapError
将 Spring AI 异常映射到相应的错误类别和重试策略。- Parameters:
exception- the Spring AI exception- Returns:
- mapped error information
-
isRetryable
根据错误的类别来判断该错误是否可以重试。- Parameters:
category- the error category- Returns:
- true if the error is potentially retryable
-
getRetryDelay
根据重试策略,获取建议的重试前等待时间(即延迟时间)。- Parameters:
strategy- the retry strategyattempt- the retry attempt number (0-based)- Returns:
- delay in milliseconds
-