@pintahub/shopify-api 1.3.5 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.GetProduct = void 0;
13
13
  const ActionBuilder_1 = require("../../ActionBuilder");
14
14
  const getGlobalID_1 = require("../../../utils/getGlobalID");
15
+ const handleErrors_1 = require("../../../utils/handleErrors");
15
16
  class GetProduct extends ActionBuilder_1.ActionBuilder {
16
17
  run(args) {
17
18
  return __awaiter(this, void 0, void 0, function* () {
@@ -68,12 +69,7 @@ class GetProduct extends ActionBuilder_1.ActionBuilder {
68
69
  }
69
70
  `;
70
71
  const { data, errors, extensions } = yield this.client.request(query);
71
- if (errors) {
72
- const { message } = Object.assign({}, errors);
73
- if (message) {
74
- throw new Error(message);
75
- }
76
- }
72
+ yield (0, handleErrors_1.handleErrors)(errors);
77
73
  const { product } = Object.assign({}, data);
78
74
  return Object.assign({
79
75
  status: 'DELETED'
@@ -0,0 +1 @@
1
+ export declare const handleErrors: (errors?: any) => Promise<void>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.handleErrors = void 0;
13
+ const handleErrors = (errors) => __awaiter(void 0, void 0, void 0, function* () {
14
+ if (!errors)
15
+ return;
16
+ const { message, graphQLErrors } = Object.assign({}, errors);
17
+ if (message) {
18
+ throw new Error(message);
19
+ }
20
+ if (graphQLErrors) {
21
+ console.error('GraphQL Errors:', graphQLErrors);
22
+ }
23
+ });
24
+ exports.handleErrors = handleErrors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pintahub/shopify-api",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",