Skip to content

Instantly share code, notes, and snippets.

View aleGpereira's full-sized avatar
😎
Enjoying

Alejandro Pereira aleGpereira

😎
Enjoying
  • Vancouver, BC, Canada
View GitHub Profile
@aleGpereira
aleGpereira / axios-catch-error.js
Created September 4, 2019 21:01 — 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 😨