@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.cjs
CHANGED
|
@@ -2177,7 +2177,7 @@ function request(config) {
|
|
|
2177
2177
|
return;
|
|
2178
2178
|
}
|
|
2179
2179
|
if (!isAbortError && toastError)
|
|
2180
|
-
(_i = appConfig2.toast) == null ? void 0 : _i.call(appConfig2, { status, msg: `\u8BF7\u6C42\u5931\u8D25,${
|
|
2180
|
+
(_i = appConfig2.toast) == null ? void 0 : _i.call(appConfig2, { status, msg: `\u8BF7\u6C42\u5931\u8D25,${JSON.stringify(e)}` });
|
|
2181
2181
|
logRequestInfo({ status, config: logConfig, startTime, e });
|
|
2182
2182
|
reject(e);
|
|
2183
2183
|
} finally {
|
|
@@ -2227,7 +2227,7 @@ function logRequestInfo(options) {
|
|
|
2227
2227
|
info.res = cloneDeep(res);
|
|
2228
2228
|
log("info", info);
|
|
2229
2229
|
} else {
|
|
2230
|
-
info.e = e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } :
|
|
2230
|
+
info.e = e instanceof Error ? { name: e.name, message: e.message, stack: e.stack } : e;
|
|
2231
2231
|
log("error", info);
|
|
2232
2232
|
}
|
|
2233
2233
|
}
|
|
@@ -2268,6 +2268,14 @@ function handleStreamResponse(response, sseTask) {
|
|
|
2268
2268
|
}
|
|
2269
2269
|
function parseResponse(response, responseType) {
|
|
2270
2270
|
return __async(this, null, function* () {
|
|
2271
|
+
if (!response.ok) {
|
|
2272
|
+
const text = yield response.text();
|
|
2273
|
+
try {
|
|
2274
|
+
return JSON.parse(text);
|
|
2275
|
+
} catch (e) {
|
|
2276
|
+
throw new Error(`HTTP Error ${response.status}: ${text || response.statusText}`);
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2271
2279
|
let resData;
|
|
2272
2280
|
if (responseType === "arraybuffer") {
|
|
2273
2281
|
resData = yield response.arrayBuffer();
|