Skip to content

Commit

Permalink
[Fix] Handled client side network issues (#833)
Browse files Browse the repository at this point in the history
added checks for client side network issues

Co-authored-by: vishnuszipstack <[email protected]>
  • Loading branch information
jagadeeswaran-zipstack and vishnuszipstack authored Jan 9, 2025
1 parent 159bef0 commit 8da57d3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions frontend/src/hooks/useExceptionHandler.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8da57d3

Please sign in to comment.