Skip to content

Instantly share code, notes, and snippets.

@mornir
Created December 23, 2017 07:14
Show Gist options
  • Save mornir/7b4eff05058617815f3363f1ee6c1c54 to your computer and use it in GitHub Desktop.
Save mornir/7b4eff05058617815f3363f1ee6c1c54 to your computer and use it in GitHub Desktop.
Async Await Error Handling
function catchErrors(fn) {
return function (...args) {
return fn(...args).catch((err) => {
console.error('Ohhhh nooo!!!!!');
console.error(err);
});
}
}
const catchError = (fn) => (...params) => fn(...params).catch(e => console.error(e))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment