Skip to content

Instantly share code, notes, and snippets.

@rgabaydullov
Created August 26, 2020 10:04
Show Gist options
  • Select an option

  • Save rgabaydullov/3693e26c6cbe090a049a64595a88def3 to your computer and use it in GitHub Desktop.

Select an option

Save rgabaydullov/3693e26c6cbe090a049a64595a88def3 to your computer and use it in GitHub Desktop.
Async code error handling example
// ...
const middlewareRequest = async (req) => {
try {
const { data } = await axios.get(req);
return data;
} catch (err) {
throw new Error(err);
}
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment