conductor-node 8.5.0 → 8.5.2
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 +42 -31
- package/dist/package.json +1 -1
- package/dist/src/errors.d.ts +2 -2
- package/dist/src/errors.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,13 +54,13 @@ Create a new integration-connection.
|
|
|
54
54
|
const newQbdConnection = await conductor.createIntegrationConnection({
|
|
55
55
|
// The identifier of the third-party platform to integrate.
|
|
56
56
|
integrationKey: "quickbooks-desktop",
|
|
57
|
-
// Your end-user's unique ID in your product's database. Must be
|
|
58
|
-
// from your other connections for the same integration.
|
|
57
|
+
// Your end-user's unique ID in your product's database. Must be
|
|
58
|
+
// distinct from your other connections for the same integration.
|
|
59
59
|
endUserSourceId: "1234-abcd",
|
|
60
60
|
// Your end-user's email address for identification only. No emails
|
|
61
61
|
// will be sent.
|
|
62
62
|
endUserEmail: "danny@constructionco.com",
|
|
63
|
-
// Your end-user's company name
|
|
63
|
+
// Your end-user's company name shown elsewhere in Conductor.
|
|
64
64
|
endUserCompanyName: "Construction Corp",
|
|
65
65
|
});
|
|
66
66
|
```
|
|
@@ -167,7 +167,7 @@ The `ConductorError` and its subclasses have the following properties:
|
|
|
167
167
|
// The unique error code. This is useful for adding special handling
|
|
168
168
|
// for specific errors.
|
|
169
169
|
code: string;
|
|
170
|
-
// The error message for your logs.
|
|
170
|
+
// The developer error message for your logs.
|
|
171
171
|
message: string;
|
|
172
172
|
// The end-user-friendly error message to display in your app.
|
|
173
173
|
endUserMessage: string;
|
|
@@ -184,34 +184,17 @@ The `ConductorError` and its subclasses have the following properties:
|
|
|
184
184
|
|
|
185
185
|
The error object you receive will have one of the following error types:
|
|
186
186
|
|
|
187
|
-
| Type | Description
|
|
188
|
-
| ------------------------------ |
|
|
189
|
-
| `ConductorIntegrationError` | An error occurred on the third-party integration's end while processing your end-user's request. |
|
|
190
|
-
| `ConductorInvalidRequestError` | You made an API call with the wrong parameters, in the wrong state, or in an invalid way.
|
|
191
|
-
| `ConductorAuthenticationError` | Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key.
|
|
192
|
-
| `ConductorConnectionError` | There was a network problem between the client (on your server) and Conductor's servers.
|
|
193
|
-
| `ConductorInternalError` | Something went wrong on Conductor's end. (These are rare.)
|
|
187
|
+
| Type | Description |
|
|
188
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
189
|
+
| `ConductorIntegrationError` | An error occurred on the third-party integration's end while processing your end-user's request. E.g., cannot connect to QuickBooks Desktop on your end-user's computer. |
|
|
190
|
+
| `ConductorInvalidRequestError` | You made an API call with the wrong parameters, in the wrong state, or in an invalid way. |
|
|
191
|
+
| `ConductorAuthenticationError` | Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key. |
|
|
192
|
+
| `ConductorConnectionError` | There was a network problem between the client (on your server) and Conductor's servers. |
|
|
193
|
+
| `ConductorInternalError` | Something went wrong on Conductor's end. (These are rare.) |
|
|
194
194
|
|
|
195
195
|
### Example
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
```ts
|
|
200
|
-
try {
|
|
201
|
-
const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
202
|
-
Name: "Test Account",
|
|
203
|
-
AccountType: "Bank",
|
|
204
|
-
OpenBalance: "100",
|
|
205
|
-
});
|
|
206
|
-
} catch (error) {
|
|
207
|
-
if (error instanceof ConductorError) {
|
|
208
|
-
// Update your app's UI to display `error.endUserMessage`.
|
|
209
|
-
}
|
|
210
|
-
// ...
|
|
211
|
-
}
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Or in the form of a rejected promise:
|
|
197
|
+
In the form of a rejected promise:
|
|
215
198
|
|
|
216
199
|
```ts
|
|
217
200
|
conductor.qbd.account
|
|
@@ -225,8 +208,36 @@ conductor.qbd.account
|
|
|
225
208
|
})
|
|
226
209
|
.catch((error) => {
|
|
227
210
|
if (error instanceof ConductorError) {
|
|
228
|
-
// Update your app's UI to display `error.endUserMessage`.
|
|
211
|
+
// ❗ TODO: Update your app's UI to display `error.endUserMessage`.
|
|
212
|
+
|
|
213
|
+
// RECOMMENDED: Send a *warning* to Sentry for integration-errors,
|
|
214
|
+
// which are your end-user's fault (e.g., cannot connect to QBD on
|
|
215
|
+
// your end-user's computer) or an *error* for other errors (e.g.,
|
|
216
|
+
// invalid API key).
|
|
217
|
+
Sentry.captureException(error, {
|
|
218
|
+
level: error instanceof ConductorIntegrationError ? "warning" : "error",
|
|
219
|
+
});
|
|
220
|
+
} else {
|
|
221
|
+
// ...
|
|
229
222
|
}
|
|
230
|
-
// ...
|
|
231
223
|
});
|
|
232
224
|
```
|
|
225
|
+
|
|
226
|
+
Or using `async`/`await`:
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
try {
|
|
230
|
+
const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
231
|
+
Name: "Test Account",
|
|
232
|
+
AccountType: "Bank",
|
|
233
|
+
OpenBalance: "100",
|
|
234
|
+
});
|
|
235
|
+
} catch (error) {
|
|
236
|
+
if (error instanceof ConductorError) {
|
|
237
|
+
// ❗ TODO: Update your app's UI to display `error.endUserMessage`.
|
|
238
|
+
// ...
|
|
239
|
+
} else {
|
|
240
|
+
// ...
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
```
|
package/dist/package.json
CHANGED
package/dist/src/errors.d.ts
CHANGED
|
@@ -52,8 +52,8 @@ export declare class ConductorError extends Error {
|
|
|
52
52
|
type ConductorErrorOptionsWithoutRawType = Omit<ConductorErrorOptions, "rawType">;
|
|
53
53
|
/**
|
|
54
54
|
* Raised when an error occurs on the third-party integration's end while
|
|
55
|
-
* processing your end-user's request. E.g.,
|
|
56
|
-
*
|
|
55
|
+
* processing your end-user's request. E.g., cannot connect to QuickBooks
|
|
56
|
+
* Desktop on the end-user's computer.
|
|
57
57
|
*/
|
|
58
58
|
export declare class ConductorIntegrationError extends ConductorError {
|
|
59
59
|
static readonly rawType: string;
|
package/dist/src/errors.js
CHANGED
|
@@ -66,8 +66,8 @@ class ConductorError extends Error {
|
|
|
66
66
|
exports.ConductorError = ConductorError;
|
|
67
67
|
/**
|
|
68
68
|
* Raised when an error occurs on the third-party integration's end while
|
|
69
|
-
* processing your end-user's request. E.g.,
|
|
70
|
-
*
|
|
69
|
+
* processing your end-user's request. E.g., cannot connect to QuickBooks
|
|
70
|
+
* Desktop on the end-user's computer.
|
|
71
71
|
*/
|
|
72
72
|
class ConductorIntegrationError extends ConductorError {
|
|
73
73
|
static rawType = "INTEGRATION_ERROR";
|
package/package.json
CHANGED