source: trip-planner-front/node_modules/rxjs/_esm2015/internal/operators/catchError.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
2export 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}
9class 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}
17class 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
Note: See TracBrowser for help on using the repository browser.