frontend/.pnpm-store/v3/files/01/1a0f53e8f64683e22263f5bd980e367103aa2ed9d75707a8bfaa8352d66a26b97acc0ddfd4de23cfc5c36659b75d92c44547e1be2282d0398af7587eb7db3c

50 lines
1.8 KiB
Plaintext

/** PURE_IMPORTS_START tslib,_innerSubscribe PURE_IMPORTS_END */
import * as tslib_1 from "tslib";
import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
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 SimpleInnerSubscriber(this);
this.add(innerSubscriber);
var innerSubscription = innerSubscribe(result, innerSubscriber);
if (innerSubscription !== innerSubscriber) {
this.add(innerSubscription);
}
}
};
return CatchSubscriber;
}(SimpleOuterSubscriber));
//# sourceMappingURL=catchError.js.map