-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
TypeScript Version: 1.8.10
Tested with node v6.1.0
I have an async function that returns a Promise. If I call resolve() everything works file. If I call reject(), await will not throw any exception and program will just hang.
I used example from this blog post and it works as described (https://blogs.msdn.microsoft.com/typescript/2015/11/03/what-about-asyncawait/). If you change it to call reject() insted of resolve(), nothing will happen and a program will hang (code below).
async function main() {
await ping();
process.exit();
}
async function ping() {
for (var i = 0; i < 10; i++) {
await delay(300);
console.log("ping");
}
}
function delay(ms: number) {
return new Promise((resolve, reject) => setTimeout(() => reject("This doesn't work!"), ms));
}
main();
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code