Преглед изворни кода

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

CaIon пре 6 месеци
родитељ
комит
caaa988c87
1 измењених фајлова са 1 додато и 1 уклоњено
  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"