Aller au contenu principal
Version: 20 R9 BETA

OpenAIError Class

La classe OpenAIError est conçue pour gérer les erreurs retournées par l'API OpenAI. Elle extrait les informations pertinentes de la réponse d'erreur et fournit des méthodes pour accéder à ces informations.

Propriétés

Propriétés d'erreurs

PropriétéTypeDescription
errCodeIntegerThe error code returned by the API or the HTTP status.
messageTextThe error message returned by the API or the HTTP status text.

Propriétés de réponse HTTP

PropriétéTypeDescription
responseObjectThe full response object.
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.

Spécifique à OpenAI

PropriétéTypeDescription
codeVariantThe code of error returned by the API.
typeTextThe type of error returned by the API.
paramTextThe parameter that caused the error, if applicable.

Code d'état HTTP

PropriétéTypeDescription
isBadRequestErrorBooleanIndicates if the error is a 400 Bad Request error.
isAuthenticationErrorBooleanIndicates if the error is a 401 Authentication error.
isPermissionDeniedErrorBooleanIndicates ∏if the error is a 403 Permission Denied error.
isNotFoundErrorBooleanIndicates if the error is a 404 Not Found error.
isUnprocessableEntityErrorBooleanIndicates if the error is a 422 Unprocessable Entity error.
isRateLimitErrorBooleanIndicates if the error is a 429 Rate Limit error.
isInternalServerErrorBooleanIndicates if the error is a 500 or higher Internal Server error.