diff --git a/src/Redux/fireRequest.tsx b/src/Redux/fireRequest.tsx index 892e6bd2ee9..876877799d8 100644 --- a/src/Redux/fireRequest.tsx +++ b/src/Redux/fireRequest.tsx @@ -149,7 +149,7 @@ export const fireRequest = ( } // 4xx Errors - if (error.response.status > 400 && error.response.status < 500) { + if (error.response.status > 400 && error.response.status < 600) { if (error.response.data && error.response.data.detail) { if (error.response.data.code === "token_not_valid") { window.location.href = `/session-expired?redirect=${window.location.href}`; @@ -167,14 +167,6 @@ export const fireRequest = ( } return; } - - // 5xx Errors - if (error.response.status >= 500 && error.response.status <= 599) { - Notification.Error({ - msg: "Something went wrong...!", - }); - return; - } } else { return error.response; } @@ -264,7 +256,7 @@ export const fireRequestV2 = ( } // 4xx Errors - if (error.response.status > 400 && error.response.status < 500) { + if (error.response.status > 400 && error.response.status < 600) { if (error.response.data && error.response.data.detail) { Notification.Error({ msg: error.response.data.detail, @@ -279,14 +271,6 @@ export const fireRequestV2 = ( } return; } - - // 5xx Errors - if (error.response.status >= 500 && error.response.status <= 599) { - Notification.Error({ - msg: "Something went wrong...!", - }); - return; - } } }); }; @@ -374,7 +358,7 @@ export const fireRequestForFiles = ( } // 4xx Errors - if (error.response.status > 400 && error.response.status < 500) { + if (error.response.status > 400 && error.response.status < 600) { if (error.response.status === 429) { return error.response; } else if (error.response.data && error.response.data.detail) { @@ -388,14 +372,6 @@ export const fireRequestForFiles = ( } return; } - - // 5xx Errors - if (error.response.status >= 500 && error.response.status <= 599) { - Notification.Error({ - msg: "Something went wrong...!", - }); - return; - } } }); }; diff --git a/src/Utils/request/handleResponse.ts b/src/Utils/request/handleResponse.ts index 8698919c869..c1139af141d 100644 --- a/src/Utils/request/handleResponse.ts +++ b/src/Utils/request/handleResponse.ts @@ -12,21 +12,14 @@ export default function handleResponse( return; } - // 5xx errors - if (res.status >= 500 && res.status < 600) { - console.error("Server error", res); - notify?.Error({ msg: "Something went wrong...!" }); - return; - } - // 400/406 Bad Request if (res.status === 400 || res.status === 406) { notify?.BadRequest({ errs: error }); return; } - // Other 400 Errors - if (res.status >= 400) { + // Other Errors between 400-599 (inclusive) + if (res.status >= 400 && res.status < 600) { // Invalid token if (!silent && error?.code === "token_not_valid") { navigate(`/session-expired?redirect=${window.location.href}`);