conductor-node 8.4.0 → 8.4.1
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 +3 -2
- package/dist/package.json +1 -1
- package/dist/src/{error.d.ts → errors.d.ts} +16 -0
- package/dist/src/{error.js → errors.js} +16 -0
- package/dist/src/graphql/graphqlOperationWrapper.d.ts +1 -1
- package/dist/src/graphql/graphqlOperationWrapper.js +5 -5
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -164,9 +164,10 @@ The `ConductorError` and its subclasses have the following properties:
|
|
|
164
164
|
{
|
|
165
165
|
// The error type.
|
|
166
166
|
type: string;
|
|
167
|
-
// The error code.
|
|
167
|
+
// The unique error code. This is useful for adding special handling for
|
|
168
|
+
// specific errors.
|
|
168
169
|
code: string;
|
|
169
|
-
// The
|
|
170
|
+
// The error message for your logs.
|
|
170
171
|
message: string;
|
|
171
172
|
// The end-user-friendly error message to display in your app.
|
|
172
173
|
endUserMessage: string;
|
package/dist/package.json
CHANGED
|
@@ -11,10 +11,26 @@ export interface ConductorErrorOptions {
|
|
|
11
11
|
* Specifically for errors returned from Conductor's API.
|
|
12
12
|
*/
|
|
13
13
|
export declare class ConductorError extends Error {
|
|
14
|
+
/**
|
|
15
|
+
* The error type.
|
|
16
|
+
*/
|
|
14
17
|
readonly type: string;
|
|
18
|
+
/**
|
|
19
|
+
* The raw error type for internal debugging.
|
|
20
|
+
*/
|
|
15
21
|
readonly rawType: string;
|
|
22
|
+
/**
|
|
23
|
+
* The unique error code. This is useful for adding special handling
|
|
24
|
+
* for specific errors.
|
|
25
|
+
*/
|
|
16
26
|
readonly code: string;
|
|
27
|
+
/**
|
|
28
|
+
* The end-user-friendly error message to display in your app.
|
|
29
|
+
*/
|
|
17
30
|
readonly endUserMessage: string;
|
|
31
|
+
/**
|
|
32
|
+
* The HTTP status code of the response that included the error.
|
|
33
|
+
*/
|
|
18
34
|
readonly statusCode: number | undefined;
|
|
19
35
|
constructor(options: ConductorErrorOptions);
|
|
20
36
|
}
|
|
@@ -8,10 +8,26 @@ exports.DEFAULT_END_USER_MESSAGE = "An internal server error occurred. Please tr
|
|
|
8
8
|
* Specifically for errors returned from Conductor's API.
|
|
9
9
|
*/
|
|
10
10
|
class ConductorError extends Error {
|
|
11
|
+
/**
|
|
12
|
+
* The error type.
|
|
13
|
+
*/
|
|
11
14
|
type;
|
|
15
|
+
/**
|
|
16
|
+
* The raw error type for internal debugging.
|
|
17
|
+
*/
|
|
12
18
|
rawType;
|
|
19
|
+
/**
|
|
20
|
+
* The unique error code. This is useful for adding special handling
|
|
21
|
+
* for specific errors.
|
|
22
|
+
*/
|
|
13
23
|
code;
|
|
24
|
+
/**
|
|
25
|
+
* The end-user-friendly error message to display in your app.
|
|
26
|
+
*/
|
|
14
27
|
endUserMessage;
|
|
28
|
+
/**
|
|
29
|
+
* The HTTP status code of the response that included the error.
|
|
30
|
+
*/
|
|
15
31
|
statusCode;
|
|
16
32
|
constructor(options) {
|
|
17
33
|
super(options.message);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ConductorError } from "../
|
|
1
|
+
import type { ConductorError } from "../errors";
|
|
2
2
|
import type { getSdk } from "../graphql/__generated__/operationTypes";
|
|
3
3
|
export declare function wrapGraphqlOperations<T extends ReturnType<typeof getSdk>>(graphqlOperations: T, verbose: boolean): T;
|
|
4
4
|
export declare function graphqlOperationWrapper<V extends {
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.wrapError = exports.graphqlOperationWrapper = exports.wrapGraphqlOperations = void 0;
|
|
7
7
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
8
|
-
const
|
|
8
|
+
const errors_1 = require("../errors");
|
|
9
9
|
const graphql_request_1 = require("graphql-request");
|
|
10
10
|
const node_util_1 = __importDefault(require("node:util"));
|
|
11
11
|
function wrapGraphqlOperations(graphqlOperations, verbose) {
|
|
@@ -63,7 +63,7 @@ function wrapError(error) {
|
|
|
63
63
|
if (error instanceof graphql_request_1.ClientError) {
|
|
64
64
|
const { response } = error;
|
|
65
65
|
if ([404, 502, 503].includes(response.status)) {
|
|
66
|
-
return (0,
|
|
66
|
+
return (0, errors_1.generateConductorError)({
|
|
67
67
|
type: "CONNECTION_ERROR",
|
|
68
68
|
code: "SERVER_UNAVAILABLE",
|
|
69
69
|
message: `The Conductor server returned a ${response.status} error, which may indicate that the server is unavailable. Please alert the Conductor team if this error persists.`,
|
|
@@ -74,14 +74,14 @@ function wrapError(error) {
|
|
|
74
74
|
const errorExtensions = nestedError?.extensions;
|
|
75
75
|
if (errorExtensions) {
|
|
76
76
|
if (errorExtensions["code"] === "GRAPHQL_VALIDATION_FAILED") {
|
|
77
|
-
return (0,
|
|
77
|
+
return (0, errors_1.generateConductorError)({
|
|
78
78
|
type: "INVALID_REQUEST_ERROR",
|
|
79
79
|
code: "CLIENT_OUTDATED",
|
|
80
80
|
message: `Your version of "${package_json_1.default.name}" is not longer compatible with the Conductor server. Please run "yarn upgrade ${package_json_1.default.name} --latest" to update.`,
|
|
81
81
|
statusCode: response.status,
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
return (0,
|
|
84
|
+
return (0, errors_1.generateConductorError)({
|
|
85
85
|
type: errorExtensions["type"],
|
|
86
86
|
code: errorExtensions["code"],
|
|
87
87
|
message: nestedError.message,
|
|
@@ -90,7 +90,7 @@ function wrapError(error) {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
return (0,
|
|
93
|
+
return (0, errors_1.generateConductorError)({
|
|
94
94
|
type: "INTERNAL_ERROR",
|
|
95
95
|
code: "INVALID_JSON_RESPONSE",
|
|
96
96
|
message: "Invalid JSON received from the Conductor API.",
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -34,5 +34,5 @@ exports.QbdTypes = void 0;
|
|
|
34
34
|
const Client_1 = __importDefault(require("./Client"));
|
|
35
35
|
// eslint-disable-next-line unicorn/prefer-export-from -- We need `Client` to be the default export, which is impossible to define with `export from`.
|
|
36
36
|
exports.default = Client_1.default;
|
|
37
|
-
__exportStar(require("./
|
|
37
|
+
__exportStar(require("./errors"), exports);
|
|
38
38
|
exports.QbdTypes = __importStar(require("./integrations/qbd/qbdTypes"));
|
package/package.json
CHANGED