merge(HEL-192): 集成问天解势修复到 .11 正式线(含 HEL-183 顶栏修复)

This commit is contained in:
总工
2026-08-27 14:58:11 +00:00
9 changed files with 376 additions and 13 deletions
+19 -2
View File
@@ -46,12 +46,29 @@
}
}
function readableRequestError(error) {
const message = String(error?.message || "");
if (
error instanceof TypeError
|| /failed to fetch|networkerror|load failed|network request failed/i.test(message)
) {
return "网络请求失败,服务暂时不可用,请稍后重试。";
}
return message || "请求失败";
}
async function request(url, method = "GET", body = null, options = {}) {
const response = await fetch(url, requestOptions(method, body, options.signal));
let response;
try {
response = await fetch(url, requestOptions(method, body, options.signal));
} catch (error) {
throw new ApiError(readableRequestError(error), 0, null);
}
const payload = await parseJson(response);
handleUnauthorized(response, url);
if (!response.ok || payload.error) {
throw new ApiError(payload.error || "请求失败", response.status, payload);
const message = payload.message || payload.error || "请求失败";
throw new ApiError(message, response.status, payload);
}
return payload;
}