| /** PURE_IMPORTS_START tslib,_OuterSubscriber,_InnerSubscriber,_util_subscribeToResult PURE_IMPORTS_END */ |
| import * as tslib_1 from "tslib"; |
| import { OuterSubscriber } from '../OuterSubscriber'; |
| import { InnerSubscriber } from '../InnerSubscriber'; |
| import { subscribeToResult } from '../util/subscribeToResult'; |
| export function catchError(selector) { |
| return function catchErrorOperatorFunction(source) { |
| var operator = new CatchOperator(selector); |
| var caught = source.lift(operator); |
| return (operator.caught = caught); |
| }; |
| } |
| var CatchOperator = /*@__PURE__*/ (function () { |
| function CatchOperator(selector) { |
| this.selector = selector; |
| } |
| CatchOperator.prototype.call = function (subscriber, source) { |
| return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught)); |
| }; |
| return CatchOperator; |
| }()); |
| var CatchSubscriber = /*@__PURE__*/ (function (_super) { |
| tslib_1.__extends(CatchSubscriber, _super); |
| function CatchSubscriber(destination, selector, caught) { |
| var _this = _super.call(this, destination) || this; |
| _this.selector = selector; |
| _this.caught = caught; |
| return _this; |
| } |
| CatchSubscriber.prototype.error = function (err) { |
| if (!this.isStopped) { |
| var result = void 0; |
| try { |
| result = this.selector(err, this.caught); |
| } |
| catch (err2) { |
| _super.prototype.error.call(this, err2); |
| return; |
| } |
| this._unsubscribeAndRecycle(); |
| var innerSubscriber = new InnerSubscriber(this, undefined, undefined); |
| this.add(innerSubscriber); |
| subscribeToResult(this, result, undefined, undefined, innerSubscriber); |
| } |
| }; |
| return CatchSubscriber; |
| }(OuterSubscriber)); |
| //# sourceMappingURL=catchError.js.map |