-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Handled client side network issues #833
base: main
Are you sure you want to change the base?
[Fix] Handled client side network issues #833
Conversation
Quality Gate passedIssues Measures |
|
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, | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, | |
}; | |
} | |
const getErrorMessage = (err, title, duration) => { | |
const errorMessages = { | |
ERR_NETWORK: "Please check your internet connection.", | |
ERR_CANCELED: "Request has been canceled.", | |
}; | |
if (errorMessages[err.code]) { | |
return { | |
type: "error", | |
content: err.code === "ERR_NETWORK" && !navigator.onLine ? errorMessages.ERR_NETWORK : errorMessages[err.code], | |
title, | |
duration, | |
}; | |
} | |
return null; // or handle other error cases | |
}; | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check and apply this change if seems okay. @jagadeeswaran-zipstack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this can be used because adding more error codes will make the content condition more complicated. If you think otherwise please let me know.
What
Why
How
Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Notes on Testing
Screenshots
Checklist
I have read and understood the Contribution Guidelines.