Skip to content
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

Set a default error message in Axios Interceptor #42

Open
uier opened this issue Jan 20, 2023 · 0 comments
Open

Set a default error message in Axios Interceptor #42

uier opened this issue Jan 20, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@uier
Copy link
Member

uier commented Jan 20, 2023

We can set a default error message Unknown error occurred :( in Axios Response Interceptor to avoid having tons of places writing something like this:

} catch (error) {
if (axios.isAxiosError(error) && error.response?.data?.message) {
errorMsg.value = error.response.data.message;
} else {
errorMsg.value = "Unknown error occurred :(";
}
throw error;
} finally {
isLoading.value = false;
}
}

@uier uier added enhancement New feature or request good first issue Good for newcomers labels Jan 20, 2023
@uier uier self-assigned this Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant