Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with Futures created from Promises #310

Merged
merged 1 commit into from
Jan 22, 2019

Conversation

Avaq
Copy link
Member

@Avaq Avaq commented Jan 20, 2019

This fix makes it so when the fork, value, done, or promise
functions throw an exception as a result of the Future entering a
crashed state, the exception is thrown in the next tick.

This means that if a Promise was used anywhere in the pipeline, we can
ensure that it does not get the opportunity to catch this exception.

The reason we want to avoid this, is because the Promise continuations
are already handled by Fluture, and if the Promise catches this
exception, it will start handling it in its own way, by emitting an
unhandledRejection event on some global event emitter.

This exact issue has been fixed before, and then optimized in #150. It was later removed in #224 for the reasons listed in #224 (comment). I now believe this was a mistake, and the benefit mentioned in that comment is too minor to weigh against the issue it creates.

@Avaq
Copy link
Member Author

Avaq commented Jan 20, 2019

I have to fix #309 before the tests will pass again.

@Avaq Avaq force-pushed the avaq/stop-catching-my-errors branch 2 times, most recently from 1854cae to b8367d4 Compare January 21, 2019 10:13
@codecov
Copy link

codecov bot commented Jan 21, 2019

Codecov Report

Merging #310 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #310   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          48     48           
  Lines        1072   1074    +2     
  Branches      224    224           
=====================================
+ Hits         1072   1074    +2
Impacted Files Coverage Δ
src/internal/utils.mjs 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4838f99...de17136. Read the comment docs.

@Avaq Avaq requested a review from dicearr January 21, 2019 13:06
This fix makes it so when the `fork`, `value`, `done`, or `promise`
functions throw an exception as a result of the Future entering a
crashed state, the exception is thrown in the next tick.

This means that if a Promise was used anywhere in the pipeline, we can
ensure that it does not get the opportunity to catch this exception.

The reason we want to avoid this, is because the Promise continuations
are already handled by Fluture, and if the Promise catches this
exception, it will start handling it in its own way, by emitting an
unhandledRejection event on some global event emitter.
@Avaq Avaq force-pushed the avaq/stop-catching-my-errors branch from b8367d4 to de17136 Compare January 22, 2019 11:22
@Avaq Avaq merged commit 6b703b7 into master Jan 22, 2019
@Avaq Avaq deleted the avaq/stop-catching-my-errors branch January 22, 2019 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants