7a1e40297d36032c74d1bf80d0abb71f2181cb6b
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm5 / internal / operators / catchError.js
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);
11     };
12 }
13 var CatchOperator = /*@__PURE__*/ (function () {
14     function CatchOperator(selector) {
15         this.selector = selector;
16     }
17     CatchOperator.prototype.call = function (subscriber, source) {
18         return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
19     };
20     return CatchOperator;
21 }());
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;
28         return _this;
29     }
30     CatchSubscriber.prototype.error = function (err) {
31         if (!this.isStopped) {
32             var result = void 0;
33             try {
34                 result = this.selector(err, this.caught);
35             }
36             catch (err2) {
37                 _super.prototype.error.call(this, err2);
38                 return;
39             }
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);
46             }
47         }
48     };
49     return CatchSubscriber;
50 }(OuterSubscriber));
51 //# sourceMappingURL=catchError.js.map