From 278bfbc3eed6702d55f24c2376021d739c9e3ce3 Mon Sep 17 00:00:00 2001 From: Trevor <104938697+treeduship@users.noreply.github.com> Date: Mon, 22 Aug 2022 17:23:03 -0600 Subject: [PATCH] fix: Fixes undefined status error -- fixes #295 (#298 by @treeduship) --- lib/apisauce.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apisauce.ts b/lib/apisauce.ts index 7862995..d001194 100644 --- a/lib/apisauce.ts +++ b/lib/apisauce.ts @@ -83,7 +83,7 @@ export const getProblemFromError = error => { if (axios.isCancel(error)) return CANCEL_ERROR // then check the specific error code - if (!error.code) return getProblemFromStatus(error.response.status) + if (!error.code) return getProblemFromStatus(error.response ? error.response.status : null) if (TIMEOUT_ERROR_CODES.includes(error.code)) return TIMEOUT_ERROR if (NODEJS_CONNECTION_ERROR_CODES.includes(error.code)) return CONNECTION_ERROR return UNKNOWN_ERROR