Class ApiException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClientException, ServerException

public class ApiException extends RuntimeException
General exception class for all exceptions originating from the GenAI API side.
See Also:
  • Constructor Details

    • ApiException

      public ApiException(int code, String status, String message)
      Creates a new ApiException with the specified code, status, and message.
      Parameters:
      code - The status code from the API response.
      status - The status from the API response.
      message - The error message from the API response.
  • Method Details

    • throwFromResponse

      @Deprecated public static void throwFromResponse(org.apache.http.client.methods.CloseableHttpResponse response)
      Deprecated.
      Throws an ApiException from the response if the response is not a OK status.
      Parameters:
      response - The response from the API call.
    • throwFromResponse

      @InternalApi public static void throwFromResponse(okhttp3.Response response)
      Throws an ApiException from the response if the response is not a OK status.
      Parameters:
      response - The response from the API call.
    • throwFromErrorNode

      @InternalApi public static void throwFromErrorNode(com.fasterxml.jackson.databind.node.ArrayNode errorNode, int code)
      Throws an ApiException from a ArrayNode. This method is for internal use only.
    • code

      public int code()
      Returns the status code from the API response.
    • status

      public String status()
      Returns the status from the API response.
    • message

      public String message()
      Returns the error message from the API response.