Skip to content

Instantly share code, notes, and snippets.

View aliemre's full-sized avatar
🎯
Focusing

Ali Emre Çakmakoğlu aliemre

🎯
Focusing
  • Webridge
  • İzmir / Türkiye
View GitHub Profile
@aliemre
aliemre / axios-catch-error.js
Created February 13, 2021 22:21 — 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 😨