1 /** PURE_IMPORTS_START tslib,_innerSubscribe PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
4 export function catchError(selector) {
5 return function catchErrorOperatorFunction(source) {
6 var operator = new CatchOperator(selector);
7 var caught = source.lift(operator);
8 return (operator.caught = caught);
11 var CatchOperator = /*@__PURE__*/ (function () {
12 function CatchOperator(selector) {
13 this.selector = selector;
15 CatchOperator.prototype.call = function (subscriber, source) {
16 return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
20 var CatchSubscriber = /*@__PURE__*/ (function (_super) {
21 tslib_1.__extends(CatchSubscriber, _super);
22 function CatchSubscriber(destination, selector, caught) {
23 var _this = _super.call(this, destination) || this;
24 _this.selector = selector;
25 _this.caught = caught;
28 CatchSubscriber.prototype.error = function (err) {
29 if (!this.isStopped) {
32 result = this.selector(err, this.caught);
35 _super.prototype.error.call(this, err2);
38 this._unsubscribeAndRecycle();
39 var innerSubscriber = new SimpleInnerSubscriber(this);
40 this.add(innerSubscriber);
41 var innerSubscription = innerSubscribe(result, innerSubscriber);
42 if (innerSubscription !== innerSubscriber) {
43 this.add(innerSubscription);
47 return CatchSubscriber;
48 }(SimpleOuterSubscriber));
49 //# sourceMappingURL=catchError.js.map