123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- // Licensed to the .NET Foundation under one or more agreements.
- // The .NET Foundation licenses this file to you under the MIT license.
- /** Error thrown when an HTTP request fails. */
- export class HttpError extends Error {
- /** Constructs a new instance of {@link @microsoft/signalr.HttpError}.
- *
- * @param {string} errorMessage A descriptive error message.
- * @param {number} statusCode The HTTP status code represented by this error.
- */
- constructor(errorMessage, statusCode) {
- const trueProto = new.target.prototype;
- super(`${errorMessage}: Status code '${statusCode}'`);
- this.statusCode = statusCode;
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- /** Error thrown when a timeout elapses. */
- export class TimeoutError extends Error {
- /** Constructs a new instance of {@link @microsoft/signalr.TimeoutError}.
- *
- * @param {string} errorMessage A descriptive error message.
- */
- constructor(errorMessage = "A timeout occurred.") {
- const trueProto = new.target.prototype;
- super(errorMessage);
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- /** Error thrown when an action is aborted. */
- export class AbortError extends Error {
- /** Constructs a new instance of {@link AbortError}.
- *
- * @param {string} errorMessage A descriptive error message.
- */
- constructor(errorMessage = "An abort occurred.") {
- const trueProto = new.target.prototype;
- super(errorMessage);
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- /** Error thrown when the selected transport is unsupported by the browser. */
- /** @private */
- export class UnsupportedTransportError extends Error {
- /** Constructs a new instance of {@link @microsoft/signalr.UnsupportedTransportError}.
- *
- * @param {string} message A descriptive error message.
- * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
- */
- constructor(message, transport) {
- const trueProto = new.target.prototype;
- super(message);
- this.transport = transport;
- this.errorType = 'UnsupportedTransportError';
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- /** Error thrown when the selected transport is disabled by the browser. */
- /** @private */
- export class DisabledTransportError extends Error {
- /** Constructs a new instance of {@link @microsoft/signalr.DisabledTransportError}.
- *
- * @param {string} message A descriptive error message.
- * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
- */
- constructor(message, transport) {
- const trueProto = new.target.prototype;
- super(message);
- this.transport = transport;
- this.errorType = 'DisabledTransportError';
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- /** Error thrown when the selected transport cannot be started. */
- /** @private */
- export class FailedToStartTransportError extends Error {
- /** Constructs a new instance of {@link @microsoft/signalr.FailedToStartTransportError}.
- *
- * @param {string} message A descriptive error message.
- * @param {HttpTransportType} transport The {@link @microsoft/signalr.HttpTransportType} this error occurred on.
- */
- constructor(message, transport) {
- const trueProto = new.target.prototype;
- super(message);
- this.transport = transport;
- this.errorType = 'FailedToStartTransportError';
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- /** Error thrown when the negotiation with the server failed to complete. */
- /** @private */
- export class FailedToNegotiateWithServerError extends Error {
- /** Constructs a new instance of {@link @microsoft/signalr.FailedToNegotiateWithServerError}.
- *
- * @param {string} message A descriptive error message.
- */
- constructor(message) {
- const trueProto = new.target.prototype;
- super(message);
- this.errorType = 'FailedToNegotiateWithServerError';
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- /** Error thrown when multiple errors have occurred. */
- /** @private */
- export class AggregateErrors extends Error {
- /** Constructs a new instance of {@link @microsoft/signalr.AggregateErrors}.
- *
- * @param {string} message A descriptive error message.
- * @param {Error[]} innerErrors The collection of errors this error is aggregating.
- */
- constructor(message, innerErrors) {
- const trueProto = new.target.prototype;
- super(message);
- this.innerErrors = innerErrors;
- // Workaround issue in Typescript compiler
- // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
- this.__proto__ = trueProto;
- }
- }
- //# sourceMappingURL=Errors.js.map
|