Class OpenAIException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.agentscope.extensions.model.openai.exception.OpenAIException
- All Implemented Interfaces:
io.agentscope.core.model.ModelHttpException,Serializable
- Direct Known Subclasses:
AuthenticationException,BadRequestException,InternalServerException,NotFoundException,PermissionDeniedException,RateLimitException,UnprocessableEntityException
public class OpenAIException
extends RuntimeException
implements io.agentscope.core.model.ModelHttpException
Base exception for all OpenAI API errors.
This is the root exception class for OpenAI-related errors. Specific error conditions are represented by subclasses.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOpenAIException(String message) OpenAIException(String message, int statusCode, String responseBody) OpenAIException(String message, int statusCode, String errorCode, String responseBody) OpenAIException(String message, String errorCode, String responseBody) OpenAIException(String message, Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionstatic OpenAIExceptionFactory method to create appropriate exception subclass based on status code.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.agentscope.core.model.ModelHttpException
isRetryableHttpStatus
-
Constructor Details
-
OpenAIException
-
OpenAIException
-
OpenAIException
-
OpenAIException
-
OpenAIException
-
-
Method Details
-
create
public static OpenAIException create(Integer statusCode, String message, String errorCode, String responseBody) Factory method to create appropriate exception subclass based on status code.- Parameters:
statusCode- HTTP status codemessage- Error messageerrorCode- OpenAI error coderesponseBody- Full response body- Returns:
- Appropriate exception subclass
-
getStatusCode
- Specified by:
getStatusCodein interfaceio.agentscope.core.model.ModelHttpException
-
getErrorCode
-
getResponseBody
-