Просмотр исходного кода

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

CaIon 6 месяцев назад
Родитель
Сommit
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"