Skip to content

Commit 82ec4f1

Browse files
mpodlasinbenlesh
authored andcommitted
fix(bindNodeCallback): errors thrown in callback will be scheduled if 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.
1 parent f685440 commit 82ec4f1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/observable/BoundNodeCallbackObservable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function dispatch<T>(this: Action<DispatchState<T>>, state: DispatchState<T>) {
153153
const err = innerArgs.shift();
154154

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

172172
const result = tryCatch(callbackFunc).apply(context, args.concat(handler));
173173
if (result === errorObject) {
174-
subject.error(errorObject.e);
174+
self.add(scheduler.schedule(dispatchError, 0, { err: errorObject.e, subject }));
175175
}
176176
}
177177

0 commit comments

Comments
 (0)