Last active
August 22, 2022 08:38
-
-
Save public/bdab69f5b80bd2700829e6aac617346f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function awaitReturn() { | |
return await Promise.resolve('awaited this promise').then((x) => { | |
throw new Error(x); | |
}); | |
} | |
async function noAwaitReturn() { | |
return Promise.resolve('did not await this promise').then((x) => { | |
throw new Error(x); | |
}); | |
} | |
try { | |
await awaitReturn(); | |
} catch (err) { | |
console.error(err); | |
} | |
try { | |
await noAwaitReturn(); | |
} catch (err) { | |
console.error(err); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code produces 2 different stack traces. You choose which one is more useful.