Skip to content

Commit

Permalink
fix(bindNodeCallback): errors thrown in callback will be scheduled if…
Browse files Browse the repository at this point in the history
… a scheduler is provided (#2344)

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.
  • Loading branch information
mpodlasin authored and benlesh committed Feb 21, 2017
1 parent f685440 commit 82ec4f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/observable/BoundNodeCallbackObservable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function dispatch<T>(this: Action<DispatchState<T>>, state: DispatchState<T>) {
const err = innerArgs.shift();

if (err) {
subject.error(err);
self.add(scheduler.schedule(dispatchError, 0, { err, subject }));
} else if (selector) {
const result = tryCatch(selector).apply(this, innerArgs);
if (result === errorObject) {
Expand All @@ -171,7 +171,7 @@ function dispatch<T>(this: Action<DispatchState<T>>, state: DispatchState<T>) {

const result = tryCatch(callbackFunc).apply(context, args.concat(handler));
if (result === errorObject) {
subject.error(errorObject.e);
self.add(scheduler.schedule(dispatchError, 0, { err: errorObject.e, subject }));
}
}

Expand Down

0 comments on commit 82ec4f1

Please sign in to comment.