Errors.js 3.2 KB

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