-
Notifications
You must be signed in to change notification settings - Fork 3k
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
feat: stopped notification handler #5750
Conversation
f144601
to
1cf1cd3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really just that re-export needs to be changed, IMO.
And I've left an open question about the setTimeout
we might want to discuss (but I don't think it should block a merge)
Also needs a rebase it seems. |
3b3d330
to
42a42ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions, but one easy to fix issue.
84d8615
to
2814491
Compare
Addressed comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one spot that could probably use a comment or two... Otherwise LGTM. Squash and merge whenever you're ready.
94ef4d4
to
72170ff
Compare
72170ff
to
fe27cd4
Compare
Description:
@benlesh
This PR is a WIP representation of what I would like to see implemented as a replacement for the
canReportError
shenanigans - which I would delete as part of this being merged.The fundamental problem is that errors reported to stopped subscribers are swallowed and no mechanism is offered to RxJS developers to let them alter this behaviour. ATM, there is one place - in the
try
/catch
that surrounds thesubscribe
withinObservable
- at which the chain of subscribers is traversed to determine whether or not any are stopped/closed and whether the error can be reported. This is pretty crappy - I feel comfortable saying this, because I wrote the code. 😅I would prefer to ditch the traversal entirely and, instead, offer a configuration point that can be used to register a handler for notifications sent to stopped observers. This would be more general than the traversal that currently happens - I can see it being useful in the DevTools - and would certainly be simpler. IMO, this shouldn't really impact anyone. ATM, in v6, errors that cannot be reported are written to the console; it's only in v7 that an error is actually thrown. Also, to my knowledge, this error swallowing has only ever affected me - when investigating two bugs in the RxJS core.
What are your thoughts on this? AFAICT, it the wiring up of the stopped-notification handler only needs to happen in
Subscriber#next
/error
/complete
. If you want me to go ahead with this, I can add some tests and can removecanReportError
, etc.IMO, this doesn't have to be perfect; it just has to be better than the traversal - and that shouldn't be too hard. 😅
Related issue (if exists): None