Errors.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. var __extends = (this && this.__extends) || (function () {
  2. var extendStatics = function (d, b) {
  3. extendStatics = Object.setPrototypeOf ||
  4. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6. return extendStatics(d, b);
  7. };
  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. // 版权所有(c).NET基金会。保留所有权利。
  15. // 在2.0版Apache许可下授权。有关许可证信息,请参见项目根目录中的License.txt。
  16. /**
  17. * Error thrown when an HTTP request fails.
  18. * HTTP请求失败时引发错误。
  19. */
  20. var HttpError = /** @class */ (function (_super) {
  21. __extends(HttpError, _super);
  22. /** Constructs a new instance of {@link @aspnet/signalr.HttpError}.
  23. *
  24. * @param {string} errorMessage A descriptive error message.
  25. * @param {number} statusCode The HTTP status code represented by this error.
  26. */
  27. function HttpError(errorMessage, statusCode) {
  28. var _newTarget = this.constructor;
  29. var _this = this;
  30. var trueProto = _newTarget.prototype;
  31. _this = _super.call(this, errorMessage) || this;
  32. _this.statusCode = statusCode;
  33. // Workaround issue in Typescript compiler
  34. // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
  35. _this.__proto__ = trueProto;
  36. return _this;
  37. }
  38. return HttpError;
  39. }(Error));
  40. export { HttpError };
  41. /**
  42. * Error thrown when a timeout elapses.
  43. * 超时错误
  44. */
  45. var TimeoutError = /** @class */ (function (_super) {
  46. __extends(TimeoutError, _super);
  47. /** Constructs a new instance of {@link @aspnet/signalr.TimeoutError}.
  48. *
  49. * @param {string} errorMessage A descriptive error message.
  50. */
  51. function TimeoutError(errorMessage) {
  52. var _newTarget = this.constructor;
  53. if (errorMessage === void 0) { errorMessage = "A timeout occurred."; }
  54. var _this = this;
  55. var trueProto = _newTarget.prototype;
  56. _this = _super.call(this, errorMessage) || this;
  57. // Workaround issue in Typescript compiler
  58. // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
  59. _this.__proto__ = trueProto;
  60. return _this;
  61. }
  62. return TimeoutError;
  63. }(Error));
  64. export { TimeoutError };
  65. /**
  66. * Error thrown when an action is aborted.
  67. * 连接错误
  68. */
  69. var AbortError = /** @class */ (function (_super) {
  70. __extends(AbortError, _super);
  71. /** Constructs a new instance of {@link AbortError}.
  72. *
  73. * @param {string} errorMessage A descriptive error message.
  74. */
  75. function AbortError(errorMessage) {
  76. var _newTarget = this.constructor;
  77. if (errorMessage === void 0) { errorMessage = "An abort occurred."; }
  78. var _this = this;
  79. var trueProto = _newTarget.prototype;
  80. _this = _super.call(this, errorMessage) || this;
  81. // Workaround issue in Typescript compiler
  82. // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
  83. _this.__proto__ = trueProto;
  84. return _this;
  85. }
  86. return AbortError;
  87. }(Error));
  88. export { AbortError };
  89. /**
  90. * Error thrown when message event is not found.
  91. * 事件未定义
  92. */
  93. var EventNotFoundError = /** @class */ (function (_super) {
  94. __extends(EventNotFoundError, _super);
  95. /** Constructs a new instance of {@link AbortError}.
  96. *
  97. * @param {string} errorMessage A descriptive error message.
  98. */
  99. function EventNotFoundError(invocationMessage, errorMessage) {
  100. var _newTarget = this.constructor;
  101. if (errorMessage === void 0) { errorMessage = "message event not found."; }
  102. var _this = this;
  103. var trueProto = _newTarget.prototype;
  104. _this = _super.call(this, errorMessage) || this;
  105. _this.methodName = invocationMessage.target;
  106. _this.invocationMessage = invocationMessage;
  107. // Workaround issue in Typescript compiler
  108. // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
  109. _this.__proto__ = trueProto;
  110. return _this;
  111. }
  112. return EventNotFoundError;
  113. }(Error));
  114. export { EventNotFoundError };