Skip to content

Instantly share code, notes, and snippets.

View amatute's full-sized avatar
🏠
Working from home

Alejandro Matute amatute

🏠
Working from home
  • Santiago, Chile.
View GitHub Profile
@amatute
amatute / axios-catch-error.js
Created November 14, 2019 22:08 — forked from fgilio/axios-catch-error.js
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨