After encountering issues with our Vue application, I observed in the Sentry logs that the problem may stem from an unreliable network:
Error: Network Error
Error: Request aborted
I wanted to display a warning message to the user but couldn't find a way to do so. I attempted to capture these errors using an Axios request interceptor, but unfortunately, they were not caught. Has anyone else had success in achieving this?
UPDATE:
The interceptor I used that failed to work is shown below. On the other hand, I do have a response interceptor in place to handle 403 errors effectively.
axios.interceptors.request.use(undefined, (err) => {
// This section never triggers for network errors
return new Promise((resolve, reject) => {
throw err;
});
});