55a06a0b860f5d89b39354d03015f4abb7050c1b
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / internal / operators / catchError.js
1 "use strict";
2 var __extends = (this && this.__extends) || (function () {
3     var extendStatics = function (d, b) {
4         extendStatics = Object.setPrototypeOf ||
5             ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6             function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7         return extendStatics(d, b);
8     }
9     return function (d, b) {
10         extendStatics(d, b);
11         function __() { this.constructor = d; }
12         d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13     };
14 })();
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var OuterSubscriber_1 = require("../OuterSubscriber");
17 var InnerSubscriber_1 = require("../InnerSubscriber");
18 var subscribeToResult_1 = require("../util/subscribeToResult");
19 function catchError(selector) {
20     return function catchErrorOperatorFunction(source) {
21         var operator = new CatchOperator(selector);
22         var caught = source.lift(operator);
23         return (operator.caught = caught);
24     };
25 }
26 exports.catchError = catchError;
27 var CatchOperator = (function () {
28     function CatchOperator(selector) {
29         this.selector = selector;
30     }
31     CatchOperator.prototype.call = function (subscriber, source) {
32         return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
33     };
34     return CatchOperator;
35 }());
36 var CatchSubscriber = (function (_super) {
37     __extends(CatchSubscriber, _super);
38     function CatchSubscriber(destination, selector, caught) {
39         var _this = _super.call(this, destination) || this;
40         _this.selector = selector;
41         _this.caught = caught;
42         return _this;
43     }
44     CatchSubscriber.prototype.error = function (err) {
45         if (!this.isStopped) {
46             var result = void 0;
47             try {
48                 result = this.selector(err, this.caught);
49             }
50             catch (err2) {
51                 _super.prototype.error.call(this, err2);
52                 return;
53             }
54             this._unsubscribeAndRecycle();
55             var innerSubscriber = new InnerSubscriber_1.InnerSubscriber(this, undefined, undefined);
56             this.add(innerSubscriber);
57             var innerSubscription = subscribeToResult_1.subscribeToResult(this, result, undefined, undefined, innerSubscriber);
58             if (innerSubscription !== innerSubscriber) {
59                 this.add(innerSubscription);
60             }
61         }
62     };
63     return CatchSubscriber;
64 }(OuterSubscriber_1.OuterSubscriber));
65 //# sourceMappingURL=catchError.js.map