attempt to catch network errors to prevent credential invalidation

This commit is contained in:
jeffvli 2025-07-30 19:51:42 -07:00
parent e5adc0caa9
commit 08fc307516

View file

@ -349,8 +349,15 @@ axiosClient.interceptors.response.use(
.catch((newError: any) => { .catch((newError: any) => {
if (newError !== TIMEOUT_ERROR) { if (newError !== TIMEOUT_ERROR) {
console.error('Error when trying to reauthenticate: ', newError); console.error('Error when trying to reauthenticate: ', newError);
if (isAxiosError(newError) && newError.code === 'ERR_NETWORK') {
console.log(
'Network error during reauthentication - preserving credentials',
);
} else {
limitedFail(currentServer); limitedFail(currentServer);
} }
}
// make sure to pass the error so axios will error later on // make sure to pass the error so axios will error later on
throw newError; throw newError;
@ -360,8 +367,12 @@ axiosClient.interceptors.response.use(
}); });
} }
if (isAxiosError(error) && error.code === 'ERR_NETWORK') {
console.log('Network error during authentication - preserving credentials');
} else {
limitedFail(currentServer); limitedFail(currentServer);
} }
}
return Promise.reject(error); return Promise.reject(error);
}, },