Skip to content

Instantly share code, notes, and snippets.

View prince272's full-sized avatar
πŸ’š

Prince Owusu prince272

πŸ’š
View GitHub Profile
@prince272
prince272 / axios-catch-error.js
Created January 10, 2021 00:45 — 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 😨