versatica / mediasoup

Cutting Edge WebRTC Video Conferencing
https://mediasoup.org
ISC License
6.18k stars 1.12k forks source link

Remove `no-async-promise-executor` linter disables #1312

Closed piranna closed 7 months ago

piranna commented 8 months ago

Documentation of eslint no-async-promise-executor rule says:

If an async executor function throws an error, the error will be lost and won’t cause the newly-constructed Promise to reject. This could make it difficult to debug and handle some errors.

(Bold is mine)

And this is exactly what has happened to me, 16 hours catching a bug due to this :-)

This PR fix and/or replace all the places where the a Promise async executor is being defined, not only in the place where I was having problems. This way, now exceptions are not missed but instead the Promises are properly rejected when an error occurs.

The fixes in the tests that I have done to remove the eslint-disable have been:

piranna commented 8 months ago

I'm be off for 2 weeks and I would like to review this. Please wait until I'm back. Thanks.

Ok, thank you for notifying in advance :-)

piranna commented 8 months ago

Linting fixed, tests are passing.

piranna commented 7 months ago

Cool, thank you for merging :-)