mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 18:13:31 +00:00
Add network error catch
This commit is contained in:
parent
fdfbad68e2
commit
ccd8d2b6b0
4 changed files with 29 additions and 5 deletions
|
|
@ -185,9 +185,15 @@ export const ssApiClient = (args: {
|
|||
status: result.status,
|
||||
};
|
||||
} catch (e: Error | AxiosError | any) {
|
||||
console.log('CATCH ERR');
|
||||
|
||||
if (isAxiosError(e)) {
|
||||
if (e.code === 'ERR_NETWORK') {
|
||||
throw new Error(
|
||||
i18n.t('error.networkError', {
|
||||
postProcess: 'sentenceCase',
|
||||
}) as string,
|
||||
);
|
||||
}
|
||||
|
||||
const error = e as AxiosError;
|
||||
const response = error.response as AxiosResponse;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue