Skip to content

Instantly share code, notes, and snippets.

@jamesseanwright
Created October 24, 2020 08:40
Show Gist options
  • Select an option

  • Save jamesseanwright/30d25d463a702321b9d559b1edc42be7 to your computer and use it in GitHub Desktop.

Select an option

Save jamesseanwright/30d25d463a702321b9d559b1edc42be7 to your computer and use it in GitHub Desktop.
Unhandled rejections in Node.js 12
'use strict';
const microtasks = () => new Promise(res => {
setImmediate(res);
});
(async () => {
try {
const retrieve = Promise.reject(new Error('No'));
await microtasks();
await retrieve;
} catch (e) {
console.error('CAUGHT!', e);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment