Explorar o código

fix: correct logic for handling nil OpenAI error codes. (close #1609)

CaIon hai 6 meses
pai
achega
caaa988c87
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      types/error.go

+ 1 - 1
types/error.go

@@ -234,7 +234,7 @@ func NewErrorWithStatusCode(err error, errorCode ErrorCode, statusCode int, ops
 func WithOpenAIError(openAIError OpenAIError, statusCode int, ops ...NewAPIErrorOptions) *NewAPIError {
 	code, ok := openAIError.Code.(string)
 	if !ok {
-		if openAIError.Code == nil {
+		if openAIError.Code != nil {
 			code = fmt.Sprintf("%v", openAIError.Code)
 		} else {
 			code = "unknown_error"