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
1b8bcfb0
authored
Aug 26, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update error types for upstream errors and JSON marshal failure
parent
b0f86bd8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
common/copy.go
+1
-1
dto/claude.go
+3
-3
relay/compatible_handler.go
+1
-1
No files found.
common/copy.go
View file @
1b8bcfb0
...
...
@@ -11,7 +11,7 @@ func DeepCopy[T any](src *T) (*T, error) {
return
nil
,
fmt
.
Errorf
(
"copy source cannot be nil"
)
}
var
dst
T
err
:=
copier
.
CopyWithOption
(
&
dst
,
src
,
copier
.
Option
{
DeepCopy
:
true
,
IgnoreEmpty
:
fals
e
})
err
:=
copier
.
CopyWithOption
(
&
dst
,
src
,
copier
.
Option
{
DeepCopy
:
true
,
IgnoreEmpty
:
tru
e
})
if
err
!=
nil
{
return
nil
,
err
}
...
...
dto/claude.go
View file @
1b8bcfb0
...
...
@@ -488,14 +488,14 @@ func (c *ClaudeResponse) GetClaudeError() *types.ClaudeError {
case
string
:
// 处理简单字符串错误
return
&
types
.
ClaudeError
{
Type
:
"error"
,
Type
:
"
upstream_
error"
,
Message
:
err
,
}
default
:
// 未知类型,尝试转换为字符串
return
&
types
.
ClaudeError
{
Type
:
"unknown_error"
,
Message
:
fmt
.
Sprintf
(
"%v"
,
err
),
Type
:
"unknown_
upstream_
error"
,
Message
:
fmt
.
Sprintf
(
"
unknown_error:
%v"
,
err
),
}
}
}
...
...
relay/compatible_handler.go
View file @
1b8bcfb0
...
...
@@ -130,7 +130,7 @@ func TextHelper(c *gin.Context, info *relaycommon.RelayInfo) (newAPIError *types
jsonData
,
err
:=
common
.
Marshal
(
convertedRequest
)
if
err
!=
nil
{
return
types
.
NewError
(
err
,
types
.
ErrorCode
ConvertRequest
Failed
,
types
.
ErrOptionWithSkipRetry
())
return
types
.
NewError
(
err
,
types
.
ErrorCode
JsonMarshal
Failed
,
types
.
ErrOptionWithSkipRetry
())
}
// apply param override
...
...
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