All files / src error.ts

100% Statements 166/166
64.47% Branches 49/76
100% Functions 54/54
100% Lines 158/158

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106  24x 24x 24x 24x 24x   75x 75x 75x   75x 75x 75x 75x   24x   24x 24x 24x   1x   24x   24x 24x 24x   2x   24x   24x 24x 24x   1x   24x   24x 24x 24x   4x   24x   24x 24x 24x   2x   24x   24x 24x 24x   1x   24x   24x 24x 24x   2x   24x   24x 24x 24x   2x   24x   24x 24x 24x   2x   24x   24x 24x 24x   1x   24x   24x 24x 24x   20x 20x 20x  
export class ShopifyError extends Error {
  constructor(...args: any) {
    super(...args);
    Object.setPrototypeOf(this, new.target.prototype);
  }
}
 
export class InvalidHmacError extends ShopifyError {}
export class InvalidShopError extends ShopifyError {}
export class InvalidHostError extends ShopifyError {}
export class InvalidJwtError extends ShopifyError {}
export class MissingJwtTokenError extends ShopifyError {}

export class SafeCompareError extends ShopifyError {}
export class UninitializedContextError extends ShopifyError {}
export class PrivateAppError extends ShopifyError {}
 
export class HttpRequestError extends ShopifyError {}
export class HttpMaxRetriesError extends ShopifyError {}
 
interface HttpResponseData {
  code: number;
  statusText: string;
  body?: {[key: string]: unknown};
  headers?: {[key: string]: unknown};
}
interface HttpResponseErrorParams extends HttpResponseData {
  message: string;
}
export class HttpResponseError extends ShopifyError {
  readonly response: HttpResponseData;
 
  public constructor({
    message,
    code,
    statusText,
    body,
    headers,
  }: HttpResponseErrorParams) {
    super(message);
    this.response = {
      code,
      statusText,
      body,
      headers,
    };
  }
}
export class HttpRetriableError extends HttpResponseError {}
export class HttpInternalError extends HttpRetriableError {}
 
interface HttpThrottlingErrorData extends HttpResponseData {
  retryAfter?: number;
}
interface HttpThrottlingErrorParams extends HttpThrottlingErrorData {
  message: string;
}
export class HttpThrottlingError extends HttpRetriableError {
  readonly response: HttpThrottlingErrorData;
 
  public constructor({retryAfter, ...params}: HttpThrottlingErrorParams) {
    super(params);
    this.response.retryAfter = retryAfter;
  }
}
 
export class RestResourceError extends ShopifyError {}
export class GraphqlQueryError extends ShopifyError {
  readonly response: {[key: string]: unknown};
 
  public constructor({
    message,
    response,
  }: {
    message: string;
    response: {[key: string]: unknown};
  }) {
    super(message);
    this.response = response;
  }
}
 
export class InvalidOAuthError extends ShopifyError {}
export class SessionNotFound extends ShopifyError {}
export class CookieNotFound extends ShopifyError {}
export class InvalidSession extends ShopifyError {}

export class InvalidWebhookError extends ShopifyError {}
export class SessionStorageError extends ShopifyError {}
 
export class MissingRequiredArgument extends ShopifyError {}
export class UnsupportedClientType extends ShopifyError {}
 
export class InvalidRequestError extends ShopifyError {}

export class BillingError extends ShopifyError {
  readonly errorData: any;
 
  public constructor({message, errorData}: {message: string; errorData: any}) {
    super(message);
 
    this.message = message;
    this.errorData = errorData;
  }
}