From d2ba601f4330b0f7b60f89c911a4fab6da9f9073 Mon Sep 17 00:00:00 2001 From: jagadeeswaran-zipstack Date: Fri, 8 Nov 2024 04:14:21 +0530 Subject: [PATCH] added checks for client side network issues --- 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;