Package com.tnsai.exceptions
Class RateLimitException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.tnsai.exceptions.TnsAIException
com.tnsai.exceptions.RateLimitException
- All Implemented Interfaces:
Serializable
Exception for rate limit errors (HTTP 429, quota exceeded).
Retryable after waiting for the suggested delay.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRateLimitException(String message) RateLimitException(String message, Long retryAfterMs) RateLimitException(String service, Long retryAfterMs, Integer remainingQuota) -
Method Summary
Modifier and TypeMethodDescriptionstatic RateLimitExceptionapiRateLimit(String endpoint, long retryAfterMs) Factory method for API rate limit.static RateLimitExceptionfromHttp429(String service, String retryAfterHeader) Factory method for HTTP 429 responses.intGets maximum recommended retry attempts.longGets suggested retry delay in milliseconds.static RateLimitExceptionllmQuotaExceeded(String model) Factory method for LLM quota exceeded.Methods inherited from class com.tnsai.exceptions.TnsAIException
getContext, getErrorCode, getMessage, getThrownAt, isRetryable, wrapMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
RateLimitException
-
RateLimitException
-
RateLimitException
-
-
Method Details
-
getRetryAfterMs
-
getService
-
getRemainingQuota
-
getSuggestedRetryDelayMs
public long getSuggestedRetryDelayMs()Description copied from class:TnsAIExceptionGets suggested retry delay in milliseconds. Override in subclasses for specific retry strategies.- Overrides:
getSuggestedRetryDelayMsin classTnsAIException
-
getMaxRetryAttempts
public int getMaxRetryAttempts()Description copied from class:TnsAIExceptionGets maximum recommended retry attempts.- Overrides:
getMaxRetryAttemptsin classTnsAIException
-
fromHttp429
Factory method for HTTP 429 responses. -
llmQuotaExceeded
Factory method for LLM quota exceeded. -
apiRateLimit
Factory method for API rate limit.
-