@base-web-kits/base-tools-web 1.3.16 → 1.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-tools-web.umd.global.js +10 -2
- package/dist/base-tools-web.umd.global.js.map +1 -1
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/web/network/request.ts +14 -2
package/dist/index.mjs
CHANGED
|
@@ -2114,7 +2114,7 @@ function request(config) {
|
|
|
2114
2114
|
return;
|
|
2115
2115
|
}
|
|
2116
2116
|
if (!isAbortError && toastError)
|
|
2117
|
-
(_i = appConfig2.toast) == null ? void 0 : _i.call(appConfig2, { status, msg: `\u8BF7\u6C42\u5931\u8D25,${
|
|
2117
|
+
(_i = appConfig2.toast) == null ? void 0 : _i.call(appConfig2, { status, msg: `\u8BF7\u6C42\u5931\u8D25,${JSON.stringify(e)}` });
|
|
2118
2118
|
logRequestInfo({ status, config: logConfig, startTime, e });
|
|
2119
2119
|
reject(e);
|
|
2120
2120
|
} finally {
|
|
@@ -2164,7 +2164,7 @@ function logRequestInfo(options) {
|
|
|
2164
2164
|
info.res = cloneDeep(res);
|
|
2165
2165
|
log("info", info);
|
|
2166
2166
|
} else {
|
|
2167
|
-
info.e = e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } :
|
|
2167
|
+
info.e = e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e;
|
|
2168
2168
|
log("error", info);
|
|
2169
2169
|
}
|
|
2170
2170
|
}
|
|
@@ -2205,6 +2205,14 @@ function handleStreamResponse(response, sseTask) {
|
|
|
2205
2205
|
}
|
|
2206
2206
|
function parseResponse(response, responseType) {
|
|
2207
2207
|
return __async(this, null, function* () {
|
|
2208
|
+
if (!response.ok) {
|
|
2209
|
+
const text = yield response.text();
|
|
2210
|
+
try {
|
|
2211
|
+
return JSON.parse(text);
|
|
2212
|
+
} catch (e) {
|
|
2213
|
+
throw new Error(`HTTP Error ${response.status}: ${text || response.statusText}`);
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2208
2216
|
let resData;
|
|
2209
2217
|
if (responseType === "arraybuffer") {
|
|
2210
2218
|
resData = yield response.arrayBuffer();
|