From 8da57d3ec77da9ca3e76d44a753113ae325c3b3b Mon Sep 17 00:00:00 2001 From: jagadeeswaran-zipstack Date: Thu, 9 Jan 2025 11:43:56 +0530 Subject: [PATCH] [Fix] Handled client side network issues (#833) added checks for client side network issues Co-authored-by: vishnuszipstack <117254672+vishnuszipstack@users.noreply.github.com> --- frontend/src/hooks/useExceptionHandler.jsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/frontend/src/hooks/useExceptionHandler.jsx b/frontend/src/hooks/useExceptionHandler.jsx index e11f8f5e8..c9472015c 100644 --- a/frontend/src/hooks/useExceptionHandler.jsx +++ b/frontend/src/hooks/useExceptionHandler.jsx @@ -18,6 +18,21 @@ const useExceptionHandler = () => { duration: duration, }; } + if (err.code === "ERR_NETWORK" && !navigator.onLine) { + return { + type: "error", + content: "Please check your internet connection.", + title: title, + duration: duration, + }; + } else if (err.code === "ERR_CANCELED") { + return { + type: "error", + content: "Request has been canceled.", + title: title, + duration: duration, + }; + } if (err?.response?.data) { const { type, errors } = err.response.data;