@@ -2,8 +2,6 @@ import {Observable} from '../Observable';
2
2
import { Operator } from '../Operator' ;
3
3
import { PartialObserver } from '../Observer' ;
4
4
import { Subscriber } from '../Subscriber' ;
5
- import { tryCatch } from '../util/tryCatch' ;
6
- import { errorObject } from '../util/errorObject' ;
7
5
import { Subscription } from '../Subscription' ;
8
6
import { OuterSubscriber } from '../OuterSubscriber' ;
9
7
import { InnerSubscriber } from '../InnerSubscriber' ;
@@ -73,17 +71,26 @@ export class MergeMapToSubscriber<T, R, R2> extends OuterSubscriber<T, R> {
73
71
innerSub : InnerSubscriber < T , R > ) : void {
74
72
const { resultSelector, destination } = this ;
75
73
if ( resultSelector ) {
76
- const result = tryCatch ( resultSelector ) ( outerValue , innerValue , outerIndex , innerIndex ) ;
77
- if ( result === errorObject ) {
78
- destination . error ( errorObject . e ) ;
79
- } else {
80
- destination . next ( result ) ;
81
- }
74
+ this . trySelectResult ( outerValue , innerValue , outerIndex , innerIndex ) ;
82
75
} else {
83
76
destination . next ( innerValue ) ;
84
77
}
85
78
}
86
79
80
+ private trySelectResult ( outerValue : T , innerValue : R ,
81
+ outerIndex : number , innerIndex : number ) : void {
82
+ const { resultSelector, destination } = this ;
83
+ let result : R2 ;
84
+ try {
85
+ result = resultSelector ( outerValue , innerValue , outerIndex , innerIndex ) ;
86
+ } catch ( err ) {
87
+ destination . error ( err ) ;
88
+ return ;
89
+ }
90
+
91
+ destination . next ( result ) ;
92
+ }
93
+
87
94
notifyError ( err : any ) : void {
88
95
this . destination . error ( err ) ;
89
96
}
0 commit comments