rauschma / exploring-js

20 stars 0 forks source link

Chapter: Async functions #28

Open rauschma opened 6 years ago

fab1o commented 5 years ago

Hi. There's a mistake on this page: https://exploringjs.com/impatient-js/ch_async-functions.html#await-and-rejected-promises

try {
  await new Error();
  assert.fail(); // actuallly we do get here
} catch (e) {
  assert.equal(e instanceof Error, true); // and we never get here
}
anthemion-org commented 5 years ago

I'm here for the same reason as @fab1o. In my tests, await new Error() does not throw. It simply returns the error instance, like any other non-promise value.

rauschma commented 2 years ago

@fab1o @anthemion-org: Fixed now. Thanks for reporting this!

effrenus commented 2 years ago

@rauschma Hi

Non-Promise values are allowed, too, and simply passed on (synchronously, without pausing the async function)

Maybe I misunderstand sentence, but non-promise values is wrapping according https://tc39.es/ecma262/multipage/ecmascript-data-types-and-values.html#await.

PS. Thx for book

atengberg commented 5 months ago

Dr R, thanks for not only writing all of these concise and clear instructional manuals for learning Javascript, but making them publicly accessible. I hope you'd consider an advanced (knowledge of reader should be at least all of the previous books) "production in practice" capturing the essence of what you've found to be most remarkable and worth reflecting on from all you've come across and coded. Not necessarily an easy thing to do, but for as well as you elucidate how Javascript works, seeing the same applied to the more complex &> nuances of the meat of the source coconut would be a release date to look forward too.

Anyways any reason AbortController not included in this section?

Thanks again!