1 /** PURE_IMPORTS_START tslib,_OuterSubscriber,_InnerSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { OuterSubscriber } from '../OuterSubscriber';
4 import { InnerSubscriber } from '../InnerSubscriber';
5 import { subscribeToResult } from '../util/subscribeToResult';
6 export function catchError(selector) {
7 return function catchErrorOperatorFunction(source) {
8 var operator = new CatchOperator(selector);
9 var caught = source.lift(operator);
10 return (operator.caught = caught);
13 var CatchOperator = /*@__PURE__*/ (function () {
14 function CatchOperator(selector) {
15 this.selector = selector;
17 CatchOperator.prototype.call = function (subscriber, source) {
18 return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
22 var CatchSubscriber = /*@__PURE__*/ (function (_super) {
23 tslib_1.__extends(CatchSubscriber, _super);
24 function CatchSubscriber(destination, selector, caught) {
25 var _this = _super.call(this, destination) || this;
26 _this.selector = selector;
27 _this.caught = caught;
30 CatchSubscriber.prototype.error = function (err) {
31 if (!this.isStopped) {
34 result = this.selector(err, this.caught);
37 _super.prototype.error.call(this, err2);
40 this._unsubscribeAndRecycle();
41 var innerSubscriber = new InnerSubscriber(this, undefined, undefined);
42 this.add(innerSubscriber);
43 var innerSubscription = subscribeToResult(this, result, undefined, undefined, innerSubscriber);
44 if (innerSubscription !== innerSubscriber) {
45 this.add(innerSubscription);
49 return CatchSubscriber;
51 //# sourceMappingURL=catchError.js.map