GenAiException

  • The GenAiException class represents exceptions that occur during service execution.

  • It includes a nested class called ErrorCode which defines the set of possible error codes.

  • The public method getErrorCode allows retrieval of the specific error code associated with the exception.

public class GenAiException extends Exception

Represents an exception that occurs during service execution.

Nested Class Summary

@interface GenAiException.ErrorCode The set of error codes. 

Public Method Summary

int
Duration
getRetryDelay()
Returns the Duration to wait before trying again, or Duration.ZERO if not known/not applicable.

Inherited Method Summary

Public Methods

public int getErrorCode ()

public Duration getRetryDelay ()

Returns the Duration to wait before trying again, or Duration.ZERO if not known/not applicable.

For requests to the ML Kit GenAI API that exceed quota, this is the amount of time to wait before trying the request again. For other requests, this value is Duration.ZERO.