Errors.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. "use strict";
  2. // Copyright (c) .NET Foundation. All rights reserved.
  3. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
  4. var __extends = (this && this.__extends) || (function () {
  5. var extendStatics = Object.setPrototypeOf ||
  6. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  7. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  8. return function (d, b) {
  9. extendStatics(d, b);
  10. function __() { this.constructor = d; }
  11. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  12. };
  13. })();
  14. Object.defineProperty(exports, "__esModule", { value: true });
  15. /** Error thrown when an HTTP request fails. */
  16. var HttpError = /** @class */ (function (_super) {
  17. __extends(HttpError, _super);
  18. /** Constructs a new instance of {@link @aspnet/signalr.HttpError}.
  19. *
  20. * @param {string} errorMessage A descriptive error message.
  21. * @param {number} statusCode The HTTP status code represented by this error.
  22. */
  23. function HttpError(errorMessage, statusCode) {
  24. var _newTarget = this.constructor;
  25. var _this = this;
  26. var trueProto = _newTarget.prototype;
  27. _this = _super.call(this, errorMessage) || this;
  28. _this.statusCode = statusCode;
  29. // Workaround issue in Typescript compiler
  30. // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
  31. _this.__proto__ = trueProto;
  32. return _this;
  33. }
  34. return HttpError;
  35. }(Error));
  36. exports.HttpError = HttpError;
  37. /** Error thrown when a timeout elapses. */
  38. var TimeoutError = /** @class */ (function (_super) {
  39. __extends(TimeoutError, _super);
  40. /** Constructs a new instance of {@link @aspnet/signalr.TimeoutError}.
  41. *
  42. * @param {string} errorMessage A descriptive error message.
  43. */
  44. function TimeoutError(errorMessage) {
  45. var _newTarget = this.constructor;
  46. if (errorMessage === void 0) { errorMessage = "A timeout occurred."; }
  47. var _this = this;
  48. var trueProto = _newTarget.prototype;
  49. _this = _super.call(this, errorMessage) || this;
  50. // Workaround issue in Typescript compiler
  51. // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
  52. _this.__proto__ = trueProto;
  53. return _this;
  54. }
  55. return TimeoutError;
  56. }(Error));
  57. exports.TimeoutError = TimeoutError;
  58. /** Error thrown when an action is aborted. */
  59. var AbortError = /** @class */ (function (_super) {
  60. __extends(AbortError, _super);
  61. /** Constructs a new instance of {@link AbortError}.
  62. *
  63. * @param {string} errorMessage A descriptive error message.
  64. */
  65. function AbortError(errorMessage) {
  66. var _newTarget = this.constructor;
  67. if (errorMessage === void 0) { errorMessage = "An abort occurred."; }
  68. var _this = this;
  69. var trueProto = _newTarget.prototype;
  70. _this = _super.call(this, errorMessage) || this;
  71. // Workaround issue in Typescript compiler
  72. // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
  73. _this.__proto__ = trueProto;
  74. return _this;
  75. }
  76. return AbortError;
  77. }(Error));
  78. exports.AbortError = AbortError;
  79. //# sourceMappingURL=Errors.js.map