conductor-node 8.6.2 → 8.6.4
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/README.md +25 -34
- package/dist/package.json +1 -1
- package/dist/src/Client.d.ts +10 -9
- package/dist/src/Client.js +9 -8
- package/dist/src/errors.d.ts +32 -14
- package/dist/src/errors.js +33 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
|
|
|
48
48
|
|
|
49
49
|
### `createIntegrationConnection(input: CreateIntegrationConnectionInput)`
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Creates a new integration-connection.
|
|
52
52
|
|
|
53
53
|
```ts
|
|
54
54
|
const newQbdConnection = await conductor.createIntegrationConnection({
|
|
@@ -82,7 +82,7 @@ The response looks like the following:
|
|
|
82
82
|
|
|
83
83
|
### `qbd.*`
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
Executes any QuickBooks Desktop (QBD) API against a specific integration-connection id. See the official [QuickBooks Desktop API Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop) for a complete list of available APIs.
|
|
86
86
|
|
|
87
87
|
```ts
|
|
88
88
|
const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
@@ -94,7 +94,7 @@ const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
|
94
94
|
|
|
95
95
|
### `getIntegrationConnections()`
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
Fetches all authorized integration-connections.
|
|
98
98
|
|
|
99
99
|
```ts
|
|
100
100
|
const qbdConnections = await conductor.getIntegrationConnections();
|
|
@@ -102,7 +102,7 @@ const qbdConnections = await conductor.getIntegrationConnections();
|
|
|
102
102
|
|
|
103
103
|
### `getIntegrationConnectionById(id: string)`
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
Fetches a single integration-connection by id.
|
|
106
106
|
|
|
107
107
|
```ts
|
|
108
108
|
const qbdConnection = await conductor.getIntegrationConnectionById(
|
|
@@ -112,9 +112,9 @@ const qbdConnection = await conductor.getIntegrationConnectionById(
|
|
|
112
112
|
|
|
113
113
|
### `pingIntegrationConnection(id: string)`
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
Checks whether the specified integration-connection can connect and process requests end-to-end.
|
|
116
116
|
|
|
117
|
-
If the connection fails, the error we encountered will be thrown as a [`ConductorError`](#error-handling). This information is useful for showing a "connection status" indicator in your app.
|
|
117
|
+
If the connection fails, the error we encountered will be thrown as a [`ConductorError`](#error-handling). This information is useful for showing a "connection status" indicator in your app. If an error occurs, we recommend displaying the property `error.endUserMessage` to your end-user in your app's UI.
|
|
118
118
|
|
|
119
119
|
In the form of a rejected promise:
|
|
120
120
|
|
|
@@ -142,7 +142,7 @@ try {
|
|
|
142
142
|
|
|
143
143
|
## TypeScript
|
|
144
144
|
|
|
145
|
-
Access the
|
|
145
|
+
Access the entire QuickBooks Desktop API through TypeScript. The `qbd.*` APIs are fully typed with inline documentation and will autocomplete in your editor.
|
|
146
146
|
|
|
147
147
|
To manually access the QBD types, import them from `conductor-node` like so:
|
|
148
148
|
|
|
@@ -158,27 +158,18 @@ const accountAddInput: QbdTypes.AccountAdd = {
|
|
|
158
158
|
|
|
159
159
|
## Error Handling
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
Any and every error thrown by the Conductor API will be an instance of `ConductorError` or one of its subclasses, which all have the following properties:
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
endUserMessage: string;
|
|
174
|
-
// The error code provided by the third-party integration when `type`
|
|
175
|
-
// is `ConductorIntegrationError`. This is useful for adding special
|
|
176
|
-
// handling for specific errors from the third-party integration.
|
|
177
|
-
integrationCode: string | undefined;
|
|
178
|
-
// The HTTP status code of the response that included the error.
|
|
179
|
-
httpStatusCode: number | undefined;
|
|
180
|
-
}
|
|
181
|
-
```
|
|
163
|
+
| Property | Type | Description |
|
|
164
|
+
| ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
165
|
+
| `type` | `string` | The error type, which categorizes the error. See [Error Types](#error-types) below.<br><br>This value is the same as the subclass name. E.g., `"ConductorIntegrationError"` or `"ConductorInvalidRequestError"`. |
|
|
166
|
+
| `code` | `string` | The unique error code from Conductor, which is useful for adding special handling for specific errors. E.g., `"INTEGRATION_CONNECTION_MISSING"`, `"API_KEY_INVALID"`, or `"QBD_REQUEST_ERROR"`.<br><br>By comparison, `type` is more general and categorizes the error. |
|
|
167
|
+
| `message` | `string` | The developer-friendly error message for your logs. |
|
|
168
|
+
| `endUserMessage` | `string` | The end-user-friendly error message to display in your app's UI for your end-user to see.<br><br>This value exists for _every_ error. E.g., if it's a QBD connection error, it might recommend the end-user to check that their QuickBooks Desktop is open and that they're logged in. But if a Conductor API key is expired, this message will just say "An internal server error occurred. Please try again later.". |
|
|
169
|
+
| `integrationCode` | `string` | The unique error code supplied by the third-party integration for errors that come from the integration (i.e., instances of `ConductorIntegrationError`). This is useful for adding special handling for specific errors from the third-party integration.<br><br>E.g., QuickBooks Desktop might return an error with `integrationCode` for something specific to its accounting logic. The integration's corresponding message for this code would be in `error.message`.<br><br>The third-party integration's error codes are not standardized, so you should not rely on this code to be the same across integrations. |
|
|
170
|
+
| `httpStatusCode` | `number` | The HTTP status code of the response that included the error. You probably won't need this. |
|
|
171
|
+
|
|
172
|
+
_Would any additional error properties be helpful?_ Let me know. Some potential additions: `request` for the original API request, `integrationKey` (e.g., `"quickbooks-desktop"`), or `integrationConnectionId`.
|
|
182
173
|
|
|
183
174
|
### Error Types
|
|
184
175
|
|
|
@@ -194,7 +185,7 @@ The error object you receive will have one of the following error types:
|
|
|
194
185
|
|
|
195
186
|
### Special Handling
|
|
196
187
|
|
|
197
|
-
If you need special handling for specific errors, you can wrap individual API calls as shown below.
|
|
188
|
+
If you need special handling for specific errors, you can wrap individual API calls, as shown below.
|
|
198
189
|
|
|
199
190
|
In the form of a rejected promise:
|
|
200
191
|
|
|
@@ -237,14 +228,14 @@ try {
|
|
|
237
228
|
|
|
238
229
|
### Global Error Handling
|
|
239
230
|
|
|
240
|
-
We do
|
|
231
|
+
We do _not_ expect you to individually wrap every API call like the examples above. Instead, we recommend your server use a single global error handler, such as [`app.use((error, ...) => { ... })` in Express](https://expressjs.com/en/guide/error-handling.html#writing-error-handlers) or [`formatError` in Apollo Server](https://apollographql.com/docs/apollo-server/data/errors/#for-client-responses), where you do the following:
|
|
241
232
|
|
|
242
|
-
1. Ensure your app's UI shows your end-user the property `error.endUserMessage`
|
|
243
|
-
2. Send the
|
|
244
|
-
- Send a **warning**
|
|
233
|
+
1. Ensure your app's UI shows your end-user the property `error.endUserMessage` for any `ConductorError` instance for any Conductor request while you log the rest of the error object.
|
|
234
|
+
2. Send the entire error object to your error-tracking service (e.g., Sentry) for all `ConductorError` instances:
|
|
235
|
+
- Send a **warning** for instances of `ConductorIntegrationError`, which are your end-user's fault; e.g., cannot connect to QBD on your end-user's computer.
|
|
245
236
|
- Send an **error** for all other `ConductorError` instances; e.g., invalid API key.
|
|
246
237
|
|
|
247
|
-
For example,
|
|
238
|
+
For example, using an Express error handler:
|
|
248
239
|
|
|
249
240
|
```ts
|
|
250
241
|
import * as Sentry from "@sentry/node";
|
|
@@ -263,7 +254,7 @@ app.use((error, req, res, next) => {
|
|
|
263
254
|
});
|
|
264
255
|
```
|
|
265
256
|
|
|
266
|
-
|
|
257
|
+
Or using Apollo Server's error handler:
|
|
267
258
|
|
|
268
259
|
```ts
|
|
269
260
|
import { ApolloServer } from "@apollo/server";
|
package/dist/package.json
CHANGED
package/dist/src/Client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { GraphqlCreateIntegrationConnectionInput, GraphqlCreateIntegrationC
|
|
|
2
2
|
import QbdIntegration from "./integrations/qbd/QbdIntegration";
|
|
3
3
|
import { getServerUrlForEnvironment } from "./utils";
|
|
4
4
|
export interface ClientOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** Logs each request and response. */
|
|
6
6
|
readonly verbose?: boolean;
|
|
7
7
|
readonly serverEnvironment?: Parameters<typeof getServerUrlForEnvironment>[0];
|
|
8
8
|
}
|
|
@@ -13,20 +13,20 @@ export default class Client {
|
|
|
13
13
|
private readonly graphqlOperations;
|
|
14
14
|
constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Fetches the specified integration-connection.
|
|
17
17
|
*
|
|
18
18
|
* @param integrationConnectionId The integration-connection ID.
|
|
19
19
|
* @returns The integration-connection.
|
|
20
20
|
*/
|
|
21
21
|
getIntegrationConnection(integrationConnectionId: GraphqlGetIntegrationConnectionQueryVariables["integrationConnectionId"]): Promise<GraphqlGetIntegrationConnectionQuery["integrationConnection"]>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Fetches all integration-connections associated with your Conductor account.
|
|
24
24
|
*
|
|
25
25
|
* @returns The integration-connections.
|
|
26
26
|
*/
|
|
27
27
|
getIntegrationConnections(): Promise<GraphqlGetIntegrationConnectionsQuery["integrationConnections"]>;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Checks whether we can successfully connect to the end-user's QBD instance.
|
|
30
30
|
*
|
|
31
31
|
* Unlike `lastHeartbeatAt`, which only checks if QBWC is running (i.e., is
|
|
32
32
|
* the user's computer on), this check fails if the user's computer is on but
|
|
@@ -35,8 +35,8 @@ export default class Client {
|
|
|
35
35
|
*
|
|
36
36
|
* @param integrationConnectionId The ID of the integration-connection.
|
|
37
37
|
* @returns The result object with the following properties:
|
|
38
|
-
* - isConnected
|
|
39
|
-
* - error
|
|
38
|
+
* - isConnected: Whether we can connect to the end-user's QBD.
|
|
39
|
+
* - error: If `isConnected=false`, this will be an object with the following
|
|
40
40
|
* properties:
|
|
41
41
|
* - error.code - The unique error code.
|
|
42
42
|
* - error.developerMessage - The technical error message for the developer.
|
|
@@ -45,7 +45,7 @@ export default class Client {
|
|
|
45
45
|
*/
|
|
46
46
|
getConnectionStatus(integrationConnectionId: GraphqlGetConnectionStatusQueryVariables["integrationConnectionId"]): Promise<GraphqlGetConnectionStatusQuery["integrationConnection"]["connectionStatus"]>;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Creates a new integration-connection.
|
|
49
49
|
*
|
|
50
50
|
* @param input - The input object to create the integration-connection.
|
|
51
51
|
* @param input.integrationKey The identifier of the third-party platform to
|
|
@@ -63,12 +63,13 @@ export default class Client {
|
|
|
63
63
|
integrationKey: "quickbooks-desktop";
|
|
64
64
|
}): Promise<GraphqlCreateIntegrationConnectionMutation["createIntegrationConnection"]["integrationConnection"]>;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Checks whether the specified integration-connection can connect and process
|
|
67
67
|
* requests end-to-end.
|
|
68
68
|
*
|
|
69
69
|
* If the connection fails, the error we encountered will be thrown as a
|
|
70
70
|
* `ConductorError`. This information is useful for showing a "connection
|
|
71
|
-
* status" indicator in your app.
|
|
71
|
+
* status" indicator in your app. If an error occurs, we recommend displaying
|
|
72
|
+
* the property `error.endUserMessage` to your end-user in your app's UI.
|
|
72
73
|
*/
|
|
73
74
|
pingIntegrationConnection(integrationConnectionId: GraphqlPingIntegrationConnectionMutationVariables["input"]["integrationConnectionId"]): Promise<GraphqlPingIntegrationConnectionMutation["pingIntegrationConnection"]>;
|
|
74
75
|
private createHeaders;
|
package/dist/src/Client.js
CHANGED
|
@@ -21,7 +21,7 @@ class Client {
|
|
|
21
21
|
this.qbd = new QbdIntegration_1.default(this.graphqlOperations);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Fetches the specified integration-connection.
|
|
25
25
|
*
|
|
26
26
|
* @param integrationConnectionId The integration-connection ID.
|
|
27
27
|
* @returns The integration-connection.
|
|
@@ -32,7 +32,7 @@ class Client {
|
|
|
32
32
|
.then((result) => result.integrationConnection);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Fetches all integration-connections associated with your Conductor account.
|
|
36
36
|
*
|
|
37
37
|
* @returns The integration-connections.
|
|
38
38
|
*/
|
|
@@ -42,7 +42,7 @@ class Client {
|
|
|
42
42
|
.then((result) => result.integrationConnections);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Checks whether we can successfully connect to the end-user's QBD instance.
|
|
46
46
|
*
|
|
47
47
|
* Unlike `lastHeartbeatAt`, which only checks if QBWC is running (i.e., is
|
|
48
48
|
* the user's computer on), this check fails if the user's computer is on but
|
|
@@ -51,8 +51,8 @@ class Client {
|
|
|
51
51
|
*
|
|
52
52
|
* @param integrationConnectionId The ID of the integration-connection.
|
|
53
53
|
* @returns The result object with the following properties:
|
|
54
|
-
* - isConnected
|
|
55
|
-
* - error
|
|
54
|
+
* - isConnected: Whether we can connect to the end-user's QBD.
|
|
55
|
+
* - error: If `isConnected=false`, this will be an object with the following
|
|
56
56
|
* properties:
|
|
57
57
|
* - error.code - The unique error code.
|
|
58
58
|
* - error.developerMessage - The technical error message for the developer.
|
|
@@ -65,7 +65,7 @@ class Client {
|
|
|
65
65
|
.then((result) => result.integrationConnection.connectionStatus);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Creates a new integration-connection.
|
|
69
69
|
*
|
|
70
70
|
* @param input - The input object to create the integration-connection.
|
|
71
71
|
* @param input.integrationKey The identifier of the third-party platform to
|
|
@@ -85,12 +85,13 @@ class Client {
|
|
|
85
85
|
.then((result) => result.createIntegrationConnection.integrationConnection);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* Checks whether the specified integration-connection can connect and process
|
|
89
89
|
* requests end-to-end.
|
|
90
90
|
*
|
|
91
91
|
* If the connection fails, the error we encountered will be thrown as a
|
|
92
92
|
* `ConductorError`. This information is useful for showing a "connection
|
|
93
|
-
* status" indicator in your app.
|
|
93
|
+
* status" indicator in your app. If an error occurs, we recommend displaying
|
|
94
|
+
* the property `error.endUserMessage` to your end-user in your app's UI.
|
|
94
95
|
*/
|
|
95
96
|
async pingIntegrationConnection(integrationConnectionId) {
|
|
96
97
|
return this.graphqlOperations
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -20,40 +20,58 @@ export interface ConductorRawGraphqlError {
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class ConductorError extends Error {
|
|
22
22
|
/**
|
|
23
|
-
* The error type.
|
|
23
|
+
* The error type, which categorizes the error.
|
|
24
|
+
*
|
|
25
|
+
* This value is the same as the subclass name. E.g.,
|
|
26
|
+
* `"ConductorIntegrationError"` or `"ConductorInvalidRequestError"`.
|
|
24
27
|
*/
|
|
25
28
|
readonly type: string;
|
|
26
29
|
/**
|
|
27
|
-
* The
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
* for specific errors.
|
|
30
|
+
* The unique error code from Conductor, which is useful for adding special
|
|
31
|
+
* handling for specific errors. E.g., `"INTEGRATION_CONNECTION_MISSING"`,
|
|
32
|
+
* `"API_KEY_INVALID"`, or `"QBD_REQUEST_ERROR"`.
|
|
33
|
+
*
|
|
34
|
+
* By comparison, `type` is more general and categorizes the error.
|
|
33
35
|
*/
|
|
34
36
|
readonly code: string;
|
|
35
37
|
/**
|
|
36
38
|
* The developer-friendly error message for your logs.
|
|
37
|
-
*
|
|
38
|
-
* (Defined in the base class but documented here for completeness.)
|
|
39
39
|
*/
|
|
40
|
+
readonly message: string;
|
|
40
41
|
/**
|
|
41
|
-
* The end-user-friendly error message to display in your app
|
|
42
|
+
* The end-user-friendly error message to display in your app's UI for your
|
|
43
|
+
* end-user to see.
|
|
44
|
+
*
|
|
45
|
+
* This value exists for *every* error. E.g., if it's a QBD connection error,
|
|
46
|
+
* it might recommend the end-user to check that their QuickBooks Desktop is
|
|
47
|
+
* open and that they're logged in. But if a Conductor API key is expired,
|
|
48
|
+
* this message will just say "An internal server error occurred. Please try
|
|
49
|
+
* again later.".
|
|
42
50
|
*/
|
|
43
51
|
readonly endUserMessage: string;
|
|
44
52
|
/**
|
|
45
|
-
* The error code
|
|
46
|
-
*
|
|
47
|
-
*
|
|
53
|
+
* The unique error code supplied by the third-party integration for errors
|
|
54
|
+
* that come from the integration (i.e., instances of
|
|
55
|
+
* `ConductorIntegrationError`). This is useful for adding special handling
|
|
56
|
+
* for specific errors from the third-party integration.
|
|
57
|
+
*
|
|
58
|
+
* E.g., QuickBooks Desktop might return an error with `integrationCode` for
|
|
59
|
+
* something specific to its accounting logic. The integration's corresponding
|
|
60
|
+
* message for this code would be in `error.message`.
|
|
48
61
|
*
|
|
49
62
|
* The third-party integration's error codes are not standardized, so you
|
|
50
63
|
* should not rely on this code to be the same across integrations.
|
|
51
64
|
*/
|
|
52
65
|
readonly integrationCode: string | undefined;
|
|
53
66
|
/**
|
|
54
|
-
* The HTTP status code of the response that included the error.
|
|
67
|
+
* The HTTP status code of the response that included the error. You probably
|
|
68
|
+
* won't need this.
|
|
55
69
|
*/
|
|
56
70
|
readonly httpStatusCode: number | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The internal representation of `type` for debugging.
|
|
73
|
+
*/
|
|
74
|
+
protected readonly rawType: string;
|
|
57
75
|
protected constructor(options: ConductorErrorOptions);
|
|
58
76
|
}
|
|
59
77
|
type ConductorErrorOptionsWithoutType = Omit<ConductorErrorOptions, "type">;
|
package/dist/src/errors.js
CHANGED
|
@@ -9,41 +9,58 @@ exports.DEFAULT_END_USER_MESSAGE = "An internal server error occurred. Please tr
|
|
|
9
9
|
*/
|
|
10
10
|
class ConductorError extends Error {
|
|
11
11
|
/**
|
|
12
|
-
* The error type.
|
|
12
|
+
* The error type, which categorizes the error.
|
|
13
|
+
*
|
|
14
|
+
* This value is the same as the subclass name. E.g.,
|
|
15
|
+
* `"ConductorIntegrationError"` or `"ConductorInvalidRequestError"`.
|
|
13
16
|
*/
|
|
14
17
|
type;
|
|
15
18
|
/**
|
|
16
|
-
* The
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* for specific errors.
|
|
19
|
+
* The unique error code from Conductor, which is useful for adding special
|
|
20
|
+
* handling for specific errors. E.g., `"INTEGRATION_CONNECTION_MISSING"`,
|
|
21
|
+
* `"API_KEY_INVALID"`, or `"QBD_REQUEST_ERROR"`.
|
|
22
|
+
*
|
|
23
|
+
* By comparison, `type` is more general and categorizes the error.
|
|
22
24
|
*/
|
|
23
25
|
code;
|
|
24
26
|
/**
|
|
25
27
|
* The developer-friendly error message for your logs.
|
|
26
|
-
*
|
|
27
|
-
* (Defined in the base class but documented here for completeness.)
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
message;
|
|
30
30
|
/**
|
|
31
|
-
* The end-user-friendly error message to display in your app
|
|
31
|
+
* The end-user-friendly error message to display in your app's UI for your
|
|
32
|
+
* end-user to see.
|
|
33
|
+
*
|
|
34
|
+
* This value exists for *every* error. E.g., if it's a QBD connection error,
|
|
35
|
+
* it might recommend the end-user to check that their QuickBooks Desktop is
|
|
36
|
+
* open and that they're logged in. But if a Conductor API key is expired,
|
|
37
|
+
* this message will just say "An internal server error occurred. Please try
|
|
38
|
+
* again later.".
|
|
32
39
|
*/
|
|
33
40
|
endUserMessage;
|
|
34
41
|
/**
|
|
35
|
-
* The error code
|
|
36
|
-
*
|
|
37
|
-
*
|
|
42
|
+
* The unique error code supplied by the third-party integration for errors
|
|
43
|
+
* that come from the integration (i.e., instances of
|
|
44
|
+
* `ConductorIntegrationError`). This is useful for adding special handling
|
|
45
|
+
* for specific errors from the third-party integration.
|
|
46
|
+
*
|
|
47
|
+
* E.g., QuickBooks Desktop might return an error with `integrationCode` for
|
|
48
|
+
* something specific to its accounting logic. The integration's corresponding
|
|
49
|
+
* message for this code would be in `error.message`.
|
|
38
50
|
*
|
|
39
51
|
* The third-party integration's error codes are not standardized, so you
|
|
40
52
|
* should not rely on this code to be the same across integrations.
|
|
41
53
|
*/
|
|
42
54
|
integrationCode;
|
|
43
55
|
/**
|
|
44
|
-
* The HTTP status code of the response that included the error.
|
|
56
|
+
* The HTTP status code of the response that included the error. You probably
|
|
57
|
+
* won't need this.
|
|
45
58
|
*/
|
|
46
59
|
httpStatusCode;
|
|
60
|
+
/**
|
|
61
|
+
* The internal representation of `type` for debugging.
|
|
62
|
+
*/
|
|
63
|
+
rawType;
|
|
47
64
|
constructor(options) {
|
|
48
65
|
super(options.message);
|
|
49
66
|
// Set `name` to the constructor name so that the error appears in logs as
|
|
@@ -58,6 +75,7 @@ class ConductorError extends Error {
|
|
|
58
75
|
this.type = this.constructor.name;
|
|
59
76
|
this.rawType = options.type;
|
|
60
77
|
this.code = options.code;
|
|
78
|
+
this.message = options.message;
|
|
61
79
|
this.endUserMessage = options.endUserMessage ?? exports.DEFAULT_END_USER_MESSAGE;
|
|
62
80
|
this.integrationCode = options.integrationCode;
|
|
63
81
|
this.httpStatusCode = options.httpStatusCode;
|
package/package.json
CHANGED