Merge pull request #986 from sususu98/fix/error-sanitizer-upstream-format [skip ci]

fix: errorSanitizer 无法识别 Anthropic 错误格式导致 400 误映射为 E015/500
This commit is contained in:
Wesley Liddick
2026-02-24 08:30:55 +08:00
committed by GitHub

View File

@@ -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
}