conductor-node 4.0.3 → 4.0.5

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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-type async TypeScript",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",
@@ -74,7 +74,7 @@ class Client {
74
74
  }
75
75
  async request(gqlQuery, variables) {
76
76
  if (this.verbose) {
77
- console.log(`Client sent request to ${this.serverURL}:`, JSON.stringify(gqlQuery, undefined, 2));
77
+ console.log(`Client sent request to ${this.serverURL}:`, gqlQuery, JSON.stringify(variables, undefined, 2));
78
78
  console.time("Request time");
79
79
  }
80
80
  try {
@@ -88,14 +88,17 @@ class Client {
88
88
  catch (error) {
89
89
  if (this.verbose) {
90
90
  console.timeEnd("Request time");
91
- console.log(JSON.stringify(error, undefined, 2));
92
91
  }
93
92
  if (error instanceof graphql_request_1.ClientError) {
94
- const errorMessage = error.response.errors?.[0]?.message ??
93
+ const { response } = error;
94
+ if ([404, 502, 503].includes(response.status)) {
95
+ throw new Error(`The server returned a (${response.status}) error, which may indicate that the server is down. Please alert the Conductor team if this error persists.`);
96
+ }
97
+ const errorMessage = response.errors?.[0]?.message ??
95
98
  // Though the property `ClientError.response.error` does *not* exist,
96
99
  // we've seen it occur (e.g., attempting to access `development`
97
100
  // environment when `ngrok` is not running locally).
98
- error.response["error"];
101
+ response["error"];
99
102
  if (errorMessage !== undefined) {
100
103
  throw new Error(errorMessage);
101
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-type async TypeScript",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",