UNPKG

@shopify/shopify-api

Version:

Shopify API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks

1 lines 6.04 kB
{"version":3,"file":"error.mjs","sources":["../../../../../lib/error.ts"],"sourcesContent":["import {AdapterResponse} from '../runtime/http/types';\n\nexport class ShopifyError extends Error {\n constructor(message?: string) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class InvalidHmacError extends ShopifyError {}\nexport class InvalidShopError extends ShopifyError {}\nexport class InvalidHostError extends ShopifyError {}\nexport class InvalidJwtError extends ShopifyError {}\nexport class MissingJwtTokenError extends ShopifyError {}\nexport class InvalidDeliveryMethodError extends ShopifyError {}\n\nexport class SafeCompareError extends ShopifyError {}\nexport class PrivateAppError extends ShopifyError {}\n\nexport class HttpRequestError extends ShopifyError {}\nexport class HttpMaxRetriesError extends ShopifyError {}\n\ninterface HttpResponseData {\n code: number;\n statusText: string;\n body?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n}\n\ninterface HttpResponseErrorParams extends HttpResponseData {\n message: string;\n}\nexport class HttpResponseError<\n ResponseType extends HttpResponseData = HttpResponseData,\n> extends ShopifyError {\n readonly response: ResponseType;\n\n constructor({\n message,\n code,\n statusText,\n body,\n headers,\n }: HttpResponseErrorParams) {\n super(message);\n this.response = {\n code,\n statusText,\n body,\n headers,\n } as ResponseType;\n }\n}\nexport class HttpRetriableError<\n ResponseType extends HttpResponseData = HttpResponseData,\n> extends HttpResponseError<ResponseType> {}\nexport class HttpInternalError extends HttpRetriableError {}\n\ninterface HttpThrottlingErrorData extends HttpResponseData {\n retryAfter?: number;\n}\ninterface HttpThrottlingErrorParams extends HttpThrottlingErrorData {\n message: string;\n}\nexport class HttpThrottlingError extends HttpRetriableError<HttpThrottlingErrorData> {\n constructor({retryAfter, ...params}: HttpThrottlingErrorParams) {\n super(params);\n this.response.retryAfter = retryAfter;\n }\n}\n\nexport class RestResourceError extends ShopifyError {}\n\ninterface GraphqlQueryErrorParams {\n message: string;\n response: Record<string, unknown>;\n headers?: Record<string, unknown>;\n body?: Record<string, any>;\n}\n\nexport class GraphqlQueryError extends ShopifyError {\n readonly response: Record<string, unknown>;\n readonly headers?: Record<string, unknown>;\n readonly body?: Record<string, any>;\n\n constructor({message, response, headers, body}: GraphqlQueryErrorParams) {\n super(message);\n this.response = response;\n this.headers = headers;\n this.body = body;\n }\n}\n\nexport class InvalidOAuthError extends ShopifyError {}\nexport class BotActivityDetected extends ShopifyError {}\nexport class CookieNotFound extends ShopifyError {}\nexport class InvalidSession extends ShopifyError {}\n\ninterface InvalidWebhookParams {\n message: string;\n response: AdapterResponse;\n}\nexport class InvalidWebhookError extends ShopifyError {\n readonly response: AdapterResponse;\n\n constructor({message, response}: InvalidWebhookParams) {\n super(message);\n this.response = response;\n }\n}\nexport class MissingWebhookCallbackError extends InvalidWebhookError {}\nexport class SessionStorageError extends ShopifyError {}\nexport class MissingRequiredArgument extends ShopifyError {}\nexport class UnsupportedClientType extends ShopifyError {}\nexport class InvalidRequestError extends ShopifyError {}\ninterface BillingErrorParams {\n message: string;\n errorData: any;\n}\nexport class BillingError extends ShopifyError {\n readonly errorData: any;\n\n constructor({message, errorData}: BillingErrorParams) {\n super(message);\n this.errorData = errorData;\n }\n}\nexport class FeatureDeprecatedError extends ShopifyError {}\n"],"names":[],"mappings":"AAEM,MAAO,YAAa,SAAQ,KAAK,CAAA;AACrC,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC1B,KAAK,CAAC,OAAO,CAAC;QACd,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC;IACnD;AACD;AAEK,MAAO,gBAAiB,SAAQ,YAAY,CAAA;AAAG;AAC/C,MAAO,gBAAiB,SAAQ,YAAY,CAAA;AAAG;AAC/C,MAAO,gBAAiB,SAAQ,YAAY,CAAA;AAAG;AAC/C,MAAO,eAAgB,SAAQ,YAAY,CAAA;AAAG;AAC9C,MAAO,oBAAqB,SAAQ,YAAY,CAAA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