fix(claim): 透出 affiliate_dash 上游错误,便于排查提交 UID 失败
上游 4xx 不再一律打成 502 兜底文案;affiliate_dash 依赖错误优先展示真实 message。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -95,18 +95,20 @@ export async function affiliateDashRequest(input: {
|
||||
logExternalHttpPacket('[affiliate-dash/http]', 'HTTP 响应失败', responsePacket, {
|
||||
level: 'warn',
|
||||
})
|
||||
throw createHttpError(
|
||||
summarizeAffiliateDashMessage(json) || `affiliate-dash 请求失败: HTTP ${response.status}`,
|
||||
{
|
||||
statusCode: 502,
|
||||
errorCode: 'affiliate_dash_http_failed',
|
||||
context: {
|
||||
status: response.status,
|
||||
message: summarizeAffiliateDashMessage(json),
|
||||
body: text,
|
||||
},
|
||||
const upstreamMessage =
|
||||
summarizeAffiliateDashMessage(json) || `affiliate-dash 请求失败: HTTP ${response.status}`
|
||||
// 上游 4xx 透传状态码,便于领取页展示真实原因;5xx 仍归一为 502。
|
||||
const statusCode =
|
||||
response.status >= 400 && response.status < 500 ? response.status : 502
|
||||
throw createHttpError(upstreamMessage, {
|
||||
statusCode,
|
||||
errorCode: 'affiliate_dash_http_failed',
|
||||
context: {
|
||||
status: response.status,
|
||||
message: summarizeAffiliateDashMessage(json),
|
||||
body: text,
|
||||
},
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
if (!isAffiliateDashSuccessResponse(json)) {
|
||||
|
||||
Reference in New Issue
Block a user