Class ApiException

  • All Implemented Interfaces:
    java.io.Serializable

    
    public class ApiException
    extends BaseException
                        

    General exception class for all exceptions originating from the GenAI API side.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ApiException(int code, String status, String message) Creates a new ApiException with the specified code, status, and message.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static void throwFromResponse(CloseableHttpResponse response) Throws an ApiException from the response if the response is not a OK status.
      static void throwFromResponse(Response response) Throws an ApiException from the response if the response is not a OK status.
      static void throwFromErrorNode(ArrayNode errorNode, int code) Throws an ApiException from a ArrayNode.
      int code() Returns the status code from the API response.
      String status() Returns the status from the API response.
      String message() Returns the error message from the API response.
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ApiException

        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 Detail

      • throwFromResponse

        @Deprecated() static void throwFromResponse(CloseableHttpResponse response)

        Throws an ApiException from the response if the response is not a OK status.

        Parameters:
        response - The response from the API call.
      • throwFromResponse

        @InternalApi() static void throwFromResponse(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() static void throwFromErrorNode(ArrayNode errorNode, int code)

        Throws an ApiException from a ArrayNode. This method is for internal use only.

      • code

         int code()

        Returns the status code from the API response.

      • status

         String status()

        Returns the status from the API response.

      • message

         String message()

        Returns the error message from the API response.