From 29e9da52473ef16001d670cd4fc0eaa5f36b5749 Mon Sep 17 00:00:00 2001 From: Andreas Skielboe Date: Thu, 10 Nov 2022 10:26:41 +0100 Subject: [PATCH] Throw ETIMEDOUT on timeout when clarifyTimeoutError is true --- src/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index ea86dba..e5b9f22 100644 --- a/src/index.js +++ b/src/index.js @@ -161,7 +161,9 @@ VERBS.concat("any").forEach(function (method) { "timeout of " + config.timeout + "ms exceeded", config, undefined, - "ECONNABORTED" + config.transitional?.clarifyTimeoutError + ? "ETIMEDOUT" + : "ECONNABORTED" ); return Promise.reject(error); }); @@ -174,7 +176,9 @@ VERBS.concat("any").forEach(function (method) { "timeout of " + config.timeout + "ms exceeded", config, undefined, - "ECONNABORTED" + config.transitional?.clarifyTimeoutError + ? "ETIMEDOUT" + : "ECONNABORTED" ); return Promise.reject(error); });