Skip to content

Instantly share code, notes, and snippets.

@gildniy
Created September 15, 2020 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gildniy/dc1d9b1ee2c363c3aacfa0bac8fbcf25 to your computer and use it in GitHub Desktop.
Save gildniy/dc1d9b1ee2c363c3aacfa0bac8fbcf25 to your computer and use it in GitHub Desktop.
Async wrapper, replacing try catch
/* The async wrapper, replacing try catch block */
// eslint-disable-next-line no-unused-vars
const asyncWrapper = fn => (...args) => fn(...args).catch(args[2]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment