From 36b0ff5242e972a49860b2156b1cdba5cf0e19d2 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 13 Mar 2023 16:47:29 +0100 Subject: [PATCH] fix(fetch): remove `undefined` error cause We have checked on the line before that `isError` is falsy, so the cause is always set to `undefined`, which is not very useful. --- lib/fetch/response.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/fetch/response.js b/lib/fetch/response.js index 09732114e7a..ff06bfb47d0 100644 --- a/lib/fetch/response.js +++ b/lib/fetch/response.js @@ -348,9 +348,7 @@ function makeNetworkError (reason) { status: 0, error: isError ? reason - : new Error(reason ? String(reason) : reason, { - cause: isError ? reason : undefined - }), + : new Error(reason ? String(reason) : reason), aborted: reason && reason.name === 'AbortError' }) }