Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 innerSubscribe_1 = require("../innerSubscribe");
  17. function catchError(selector) {
  18. return function catchErrorOperatorFunction(source) {
  19. var operator = new CatchOperator(selector);
  20. var caught = source.lift(operator);
  21. return (operator.caught = caught);
  22. };
  23. }
  24. exports.catchError = catchError;
  25. var CatchOperator = (function () {
  26. function CatchOperator(selector) {
  27. this.selector = selector;
  28. }
  29. CatchOperator.prototype.call = function (subscriber, source) {
  30. return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
  31. };
  32. return CatchOperator;
  33. }());
  34. var CatchSubscriber = (function (_super) {
  35. __extends(CatchSubscriber, _super);
  36. function CatchSubscriber(destination, selector, caught) {
  37. var _this = _super.call(this, destination) || this;
  38. _this.selector = selector;
  39. _this.caught = caught;
  40. return _this;
  41. }
  42. CatchSubscriber.prototype.error = function (err) {
  43. if (!this.isStopped) {
  44. var result = void 0;
  45. try {
  46. result = this.selector(err, this.caught);
  47. }
  48. catch (err2) {
  49. _super.prototype.error.call(this, err2);
  50. return;
  51. }
  52. this._unsubscribeAndRecycle();
  53. var innerSubscriber = new innerSubscribe_1.SimpleInnerSubscriber(this);
  54. this.add(innerSubscriber);
  55. var innerSubscription = innerSubscribe_1.innerSubscribe(result, innerSubscriber);
  56. if (innerSubscription !== innerSubscriber) {
  57. this.add(innerSubscription);
  58. }
  59. }
  60. };
  61. return CatchSubscriber;
  62. }(innerSubscribe_1.SimpleOuterSubscriber));
  63. //# sourceMappingURL=catchError.js.map