Skip to content

Instantly share code, notes, and snippets.

View eiberham's full-sized avatar
:shipit:
Learning

Abraham Cedeño eiberham

:shipit:
Learning
View GitHub Profile
@fgilio
fgilio / axios-catch-error.js
Last active August 15, 2024 01:45
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 😨