Skip to content

Instantly share code, notes, and snippets.

@FauxFaux
Created January 30, 2024 23:07
Show Gist options
  • Save FauxFaux/f00effb64b4f84dc6747ec93e4eddf4c to your computer and use it in GitHub Desktop.
Save FauxFaux/f00effb64b4f84dc6747ec93e4eddf4c to your computer and use it in GitHub Desktop.
async function throws() {
throw new Error('I threw!');
}
async function main() {
const result = throws();
console.log('seven');
await sleep(10);
console.log('nine');
await result;
}
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
main().then(console.log).catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment