Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
386c2546
authored
Jul 19, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: set ErrorType to OpenAIError in RelayErrorHandler for better error categorization
parent
af652718
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
service/error.go
+2
-0
No files found.
service/error.go
View file @
386c2546
...
...
@@ -82,6 +82,7 @@ func ClaudeErrorWrapperLocal(err error, code string, statusCode int) *dto.Claude
func
RelayErrorHandler
(
resp
*
http
.
Response
,
showBodyWhenFail
bool
)
(
newApiErr
*
types
.
NewAPIError
)
{
newApiErr
=
&
types
.
NewAPIError
{
StatusCode
:
resp
.
StatusCode
,
ErrorType
:
types
.
ErrorTypeOpenAIError
,
}
responseBody
,
err
:=
io
.
ReadAll
(
resp
.
Body
)
...
...
@@ -105,6 +106,7 @@ func RelayErrorHandler(resp *http.Response, showBodyWhenFail bool) (newApiErr *t
newApiErr
=
types
.
WithOpenAIError
(
errResponse
.
Error
,
resp
.
StatusCode
)
}
else
{
newApiErr
=
types
.
NewErrorWithStatusCode
(
errors
.
New
(
errResponse
.
ToMessage
()),
types
.
ErrorCodeBadResponseStatusCode
,
resp
.
StatusCode
)
newApiErr
.
ErrorType
=
types
.
ErrorTypeOpenAIError
}
return
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment