1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { OuterSubscriber } from '../OuterSubscriber';
import { InnerSubscriber } from '../InnerSubscriber';
import { subscribeToResult } from '../util/subscribeToResult';
export function catchError(selector) {
return function catchErrorOperatorFunction(source) {
const operator = new CatchOperator(selector);
const caught = source.lift(operator);
return (operator.caught = caught);
};
}
class CatchOperator {
constructor(selector) {
this.selector = selector;
}
call(subscriber, source) {
return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
}
}
class CatchSubscriber extends OuterSubscriber {
constructor(destination, selector, caught) {
super(destination);
this.selector = selector;
this.caught = caught;
}
error(err) {
if (!this.isStopped) {
let result;
try {
result = this.selector(err, this.caught);
}
catch (err2) {
super.error(err2);
return;
}
this._unsubscribeAndRecycle();
const innerSubscriber = new InnerSubscriber(this, undefined, undefined);
this.add(innerSubscriber);
subscribeToResult(this, result, undefined, undefined, innerSubscriber);
}
}
}
//# sourceMappingURL=catchError.js.map