Skip to content

Instantly share code, notes, and snippets.

@krukid
Created July 7, 2023 08:24
Show Gist options
  • Save krukid/773d934123761f2bf041cd47831d525b to your computer and use it in GitHub Desktop.
Save krukid/773d934123761f2bf041cd47831d525b to your computer and use it in GitHub Desktop.
async function main() {
try {
const t = setTimeout(() => {
throw new Error('Error');
}, 1000);
await new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
clearTimeout(t);
}, 1500);
});
console.log('done');
}
catch (err) {
console.log('caught', err);
}
}
process.on('uncaughtException', (err) => {
console.log('uncaught', err);
});
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment