@defjs/core 0.0.0-test-0011 → 0.0.0-test-0012
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/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -392,7 +392,7 @@ function makeResponse(options) {
|
|
|
392
392
|
const url = options.url ?? "";
|
|
393
393
|
const headers = options.headers ?? new Headers;
|
|
394
394
|
const body = options.body ?? null;
|
|
395
|
-
if (!ok) {
|
|
395
|
+
if (!ok || options.error) {
|
|
396
396
|
const error = options.error || new Error(`Http failure response for ${options.url}: ${status} ${statusText}`);
|
|
397
397
|
return {
|
|
398
398
|
ok: false,
|
|
@@ -524,7 +524,7 @@ async function fetchHandler(httpRequest) {
|
|
|
524
524
|
body = parseBody(httpRequest, response2, chunksAll);
|
|
525
525
|
} catch (error) {
|
|
526
526
|
throw makeResponse({
|
|
527
|
-
error:
|
|
527
|
+
error: new Error("Parse response body error", { cause: error }),
|
|
528
528
|
url,
|
|
529
529
|
status,
|
|
530
530
|
statusText,
|