Class OpenAIOfficialModelException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.agentscope.core.model.ModelException
io.agentscope.extensions.model.openaiofficial.OpenAIOfficialModelException
All Implemented Interfaces:
io.agentscope.core.model.ModelHttpException, Serializable

public class OpenAIOfficialModelException extends io.agentscope.core.model.ModelException implements io.agentscope.core.model.ModelHttpException
Exception type for the openai-official provider.

Extends ModelException and implements ModelHttpException so that HTTP-status-aware retry classification works through both the core ExecutionConfig.RETRYABLE_ERRORS safety net and the module's own retryOn predicate.

Overrides isRetryableHttpStatus() to include 408 and 409 in addition to the core default (429 and 5xx). This aligns with the SDK RetryingHttpClient.shouldRetry status-code set {408, 409, 429, >=500}.

See Also:
  • Constructor Details

    • OpenAIOfficialModelException

      public OpenAIOfficialModelException(String message, Throwable cause, String modelName)
      Creates an exception with no HTTP status (for non-HTTP SDK failures such as OpenAIIoException, OpenAIInvalidDataException, or validation errors).
      Parameters:
      message - the error message
      cause - the underlying SDK exception, or null
      modelName - the model name, or null if unknown
    • OpenAIOfficialModelException

      public OpenAIOfficialModelException(String message, Throwable cause, String modelName, Integer statusCode)
      Creates an exception with an HTTP status code (for OpenAIServiceException subclasses such as BadRequestException, RateLimitException, etc.).
      Parameters:
      message - the error message
      cause - the underlying SDK exception
      modelName - the model name, or null if unknown
      statusCode - the HTTP status code from the SDK exception
    • OpenAIOfficialModelException

      public OpenAIOfficialModelException(String message)
      Creates a validation/non-retryable exception with no cause and no HTTP status.
      Parameters:
      message - the validation message
    • OpenAIOfficialModelException

      public OpenAIOfficialModelException(String message, String modelName)
      Creates a validation/non-retryable exception with no cause, no HTTP status, but with a known model name.
      Parameters:
      message - the validation message
      modelName - the model name, or null if unknown
  • Method Details

    • getStatusCode

      public Integer getStatusCode()
      Specified by:
      getStatusCode in interface io.agentscope.core.model.ModelHttpException
    • isRetryableHttpStatus

      public boolean isRetryableHttpStatus()
      Specified by:
      isRetryableHttpStatus in interface io.agentscope.core.model.ModelHttpException