Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / operators / catchError.js
1 import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
2 export function catchError(selector) {
3     return function catchErrorOperatorFunction(source) {
4         const operator = new CatchOperator(selector);
5         const caught = source.lift(operator);
6         return (operator.caught = caught);
7     };
8 }
9 class CatchOperator {
10     constructor(selector) {
11         this.selector = selector;
12     }
13     call(subscriber, source) {
14         return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
15     }
16 }
17 class CatchSubscriber extends SimpleOuterSubscriber {
18     constructor(destination, selector, caught) {
19         super(destination);
20         this.selector = selector;
21         this.caught = caught;
22     }
23     error(err) {
24         if (!this.isStopped) {
25             let result;
26             try {
27                 result = this.selector(err, this.caught);
28             }
29             catch (err2) {
30                 super.error(err2);
31                 return;
32             }
33             this._unsubscribeAndRecycle();
34             const innerSubscriber = new SimpleInnerSubscriber(this);
35             this.add(innerSubscriber);
36             const innerSubscription = innerSubscribe(result, innerSubscriber);
37             if (innerSubscription !== innerSubscriber) {
38                 this.add(innerSubscription);
39             }
40         }
41     }
42 }
43 //# sourceMappingURL=catchError.js.map