Saltar para o conteúdo principal
Versão: 20 R9 BETA

OpenAIError Class

The OpenAIError class is designed to handle errors returned by the OpenAI API. It extracts relevant information from the error response and provides methods to access this information.

Propriedades

Propriedades do erro

PropriedadeTipoDescrição
errCodeIntegerThe error code returned by the API or the HTTP status.
messageTextThe error message returned by the API or the HTTP status text.

HTTP reponse properties

PropriedadeTipoDescrição
responseObjectO objeto de resposta completo.
statusIntegerThe HTTP status code of the response.
statusTextTextThe status text of the HTTP response.
bodyObjectThe body of the error response.
headersObjectThe headers of the error response.
requestIDTextThe request ID from the error response headers.

OpenAI específico

PropriedadeTipoDescrição
códigoDiferente deThe code of error returned by the API.
tipoTextThe type of error returned by the API.
paramTextThe parameter that caused the error, if applicable.

Código de estado HTTP

PropriedadeTipoDescrição
isBadRequestErrorParâmetrosIndicates if the error is a 400 Bad Request error.
isAuthenticationErrorParâmetrosIndicates if the error is a 401 Authentication error.
isPermissionDeniedErrorParâmetrosIndicates ∏if the error is a 403 Permission Denied error.
isNotFoundErrorParâmetrosIndicates if the error is a 404 Not Found error.
isUnprocessableEntityErrorParâmetrosIndicates if the error is a 422 Unprocessable Entity error.
isRateLimitErrorParâmetrosIndicates if the error is a 429 Rate Limit error.
isInternalServerErrorParâmetrosIndicates if the error is a 500 or higher Internal Server error.