first commit
This commit is contained in:
21
core/providers/cohere/errors.go
Normal file
21
core/providers/cohere/errors.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package cohere
|
||||
|
||||
import (
|
||||
providerUtils "github.com/maximhq/bifrost/core/providers/utils"
|
||||
"github.com/maximhq/bifrost/core/schemas"
|
||||
"github.com/valyala/fasthttp"
|
||||
)
|
||||
|
||||
func parseCohereError(resp *fasthttp.Response) *schemas.BifrostError {
|
||||
var errorResp CohereError
|
||||
bifrostErr := providerUtils.HandleProviderAPIError(resp, &errorResp)
|
||||
bifrostErr.Type = &errorResp.Type
|
||||
if bifrostErr.Error == nil {
|
||||
bifrostErr.Error = &schemas.ErrorField{}
|
||||
}
|
||||
bifrostErr.Error.Message = errorResp.Message
|
||||
if errorResp.Code != nil {
|
||||
bifrostErr.Error.Code = errorResp.Code
|
||||
}
|
||||
return bifrostErr
|
||||
}
|
||||
Reference in New Issue
Block a user