From a485c9557d72949a1810829dea4fc80cca311669 Mon Sep 17 00:00:00 2001 From: Warren Parad Date: Wed, 6 Dec 2023 16:38:31 +0100 Subject: [PATCH] Add properties to error after retry. --- src/httpClient.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/httpClient.js b/src/httpClient.js index 4fc550b..3aef788 100644 --- a/src/httpClient.js +++ b/src/httpClient.js @@ -21,8 +21,10 @@ async function retryExecutor(func) { const result = await func(); return result; } catch (error) { + error.retryCount = iteration; lastError = error; if (isNetworkError(error) || error.message === 'Network Error' || error.code === 'ERR_NETWORK' || !error.status || error.status >= 500) { + lastError.isNetworkError = true; await new Promise(resolve => setTimeout(resolve, 10 * 2 ** iteration)); continue; }