mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-05-01 04:21:47 +00:00
fix: correct logic for handling nil OpenAI error codes. (close #1609)
This commit is contained in:
@@ -234,7 +234,7 @@ func NewErrorWithStatusCode(err error, errorCode ErrorCode, statusCode int, ops
|
|||||||
func WithOpenAIError(openAIError OpenAIError, statusCode int, ops ...NewAPIErrorOptions) *NewAPIError {
|
func WithOpenAIError(openAIError OpenAIError, statusCode int, ops ...NewAPIErrorOptions) *NewAPIError {
|
||||||
code, ok := openAIError.Code.(string)
|
code, ok := openAIError.Code.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
if openAIError.Code == nil {
|
if openAIError.Code != nil {
|
||||||
code = fmt.Sprintf("%v", openAIError.Code)
|
code = fmt.Sprintf("%v", openAIError.Code)
|
||||||
} else {
|
} else {
|
||||||
code = "unknown_error"
|
code = "unknown_error"
|
||||||
|
|||||||
Reference in New Issue
Block a user