mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-03-30 04:47:00 +00:00
Merge pull request #986 from sususu98/fix/error-sanitizer-upstream-format [skip ci]
fix: errorSanitizer 无法识别 Anthropic 错误格式导致 400 误映射为 E015/500
This commit is contained in:
@@ -56,7 +56,7 @@ const ERROR_MATCHERS = [
|
||||
{ pattern: /model.*not.*found|model.*unavailable|unsupported.*model/i, code: 'E006' },
|
||||
|
||||
// 请求错误
|
||||
{ pattern: /bad.*request|invalid.*request|malformed/i, code: 'E005' },
|
||||
{ pattern: /bad.*request|invalid.*request|invalid.*argument|malformed/i, code: 'E005' },
|
||||
{ pattern: /not.*found|404/i, code: 'E010' },
|
||||
|
||||
// 上游错误
|
||||
@@ -158,6 +158,9 @@ function extractOriginalMessage(error) {
|
||||
if (error.message) {
|
||||
return error.message
|
||||
}
|
||||
if (error.error?.message) {
|
||||
return error.error.message
|
||||
}
|
||||
if (error.response?.data?.error?.message) {
|
||||
return error.response.data.error.message
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user