summaryrefslogtreecommitdiff
path: root/ext/fetch/26_fetch.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fetch/26_fetch.js')
-rw-r--r--ext/fetch/26_fetch.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/fetch/26_fetch.js b/ext/fetch/26_fetch.js
index 674d99709..e2809187b 100644
--- a/ext/fetch/26_fetch.js
+++ b/ext/fetch/26_fetch.js
@@ -65,7 +65,7 @@ const REQUEST_BODY_HEADER_NAMES = [
/**
* @param {number} rid
- * @returns {Promise<{ status: number, statusText: string, headers: [string, string][], url: string, responseRid: number, error: string? }>}
+ * @returns {Promise<{ status: number, statusText: string, headers: [string, string][], url: string, responseRid: number, error: [string, string]? }>}
*/
function opFetchSend(rid) {
return op_fetch_send(rid);
@@ -177,8 +177,9 @@ async function mainFetch(req, recursive, terminator) {
}
}
// Re-throw any body errors
- if (resp.error) {
- throw new TypeError("body failed", { cause: new Error(resp.error) });
+ if (resp.error !== null) {
+ const { 0: message, 1: cause } = resp.error;
+ throw new TypeError(message, { cause: new Error(cause) });
}
if (terminator.aborted) return abortedNetworkError();