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(bindNodeCallback): use scheduler on error in callback #2344

Merged
merged 1 commit into from
Feb 21, 2017
Merged

fix(bindNodeCallback): use scheduler on error in callback #2344

merged 1 commit into from
Feb 21, 2017

Conversation

mpodlasin
Copy link
Contributor

Description:

bindNodeCallback with schedulers have different behaviour for errors from selector function and different for errors passed to callback. When selector throws, scheduler is used to schedule error as seen in
https://github.com/ReactiveX/rxjs/blob/master/src/observable/BoundNodeCallbackObservable.ts#L160

Yet when error comes from error object passed to callback by input function, error is just passed to subscriber, ignoring current scheduler:
https://github.com/ReactiveX/rxjs/blob/master/src/observable/BoundNodeCallbackObservable.ts#L156

I decided to let scheduler send error, since for me personally it is more predictable behaviour, when scheduler is passed. But if I am wrong and all errors should be sent synchronously, let me know and I will switch that change in other direction. Either way there is some disparity here.

Have a great day.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.689% when pulling 2e6902d on Podlas29:bind-node-callback-schedule-error into 6ce4773 on ReactiveX:master.

@jayphelps
Copy link
Member

This is a great question. @Blesh do you have any insight?

There is another place where it sync goes down error channel as well, right below https://github.com/ReactiveX/rxjs/blob/master/src/observable/BoundNodeCallbackObservable.ts#L174

@benlesh
Copy link
Member

benlesh commented Feb 16, 2017

Yes, this is a bug. Good catch, @Podlas29

When operator is passed a scheduler, use that scheduler
to call error in observer when error object is passed
to callback or calling input function fails, so that
all kinds of errors cause the same behaviour.
@coveralls
Copy link

coveralls commented Feb 16, 2017

Coverage Status

Coverage remained the same at 97.688% when pulling 74460de on Podlas29:bind-node-callback-schedule-error into 77a582e on ReactiveX:master.

@mpodlasin
Copy link
Contributor Author

I fixed also second error call, which @jayphelps pointed out.

@benlesh benlesh merged commit 82ec4f1 into ReactiveX:master Feb 21, 2017
@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants