fix: correct logic for handling nil OpenAI error codes. (close #1609)
This commit is contained in:
parent
87d0d12d39
commit
1a5ba75068
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user