fix: create NewOpenAIError function for improved error handling in Relay

This commit is contained in:
CaIon committed 2025-07-19 11:28:18 +08:00
1 parent 386c254682
commit b85106b571
2 files changed
+9 -1

No files matched your search

+8
View File
@@ -152,6 +152,14 @@ func NewError(err error, errorCode ErrorCode) *NewAPIError {
}
}
func NewOpenAIError(err error, errorCode ErrorCode, statusCode int) *NewAPIError {
openaiError := OpenAIError{
Message: err.Error(),
Type: string(errorCode),
}
return WithOpenAIError(openaiError, statusCode)
}
func NewErrorWithStatusCode(err error, errorCode ErrorCode, statusCode int) *NewAPIError {
return &NewAPIError{
Err: err,