@intuned/runtime-dev 1.2.0-cli.0 → 1.2.0-cli.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.
|
@@ -19,6 +19,7 @@ var _enums = require("../../../runtime/enums");
|
|
|
19
19
|
var _terminal = require("../terminal");
|
|
20
20
|
var _path = _interopRequireDefault(require("path"));
|
|
21
21
|
var _fsExtra = require("fs-extra");
|
|
22
|
+
var _runApi = require("../../../common/runApi");
|
|
22
23
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
23
24
|
class CLIError extends Error {
|
|
24
25
|
constructor(message, options) {
|
|
@@ -66,6 +67,13 @@ function withErrorLogging(fn) {
|
|
|
66
67
|
} else {
|
|
67
68
|
(0, _terminal.terminal)(`${error.message}\n`);
|
|
68
69
|
}
|
|
70
|
+
} else if (error instanceof _runApi.AutomationError) {
|
|
71
|
+
(0, _terminal.terminal)(`^r^+An error occurred while running the API:^:\n`);
|
|
72
|
+
(0, _terminal.terminal)(`^r${error.error.message}^:\n`);
|
|
73
|
+
if (error.error.stack) {
|
|
74
|
+
(0, _terminal.terminal)(`^r^+Stack trace:^:\n`);
|
|
75
|
+
(0, _terminal.terminal)(`^r${error.error.stack}^:\n`);
|
|
76
|
+
}
|
|
69
77
|
} else {
|
|
70
78
|
(0, _terminal.terminal)(`^r^+An error occurred:^: ^R${error.message}^:\n^r^+Please report this issue to the Intuned team.^:\n`);
|
|
71
79
|
}
|
|
@@ -50,8 +50,11 @@ async function executeRunApiCLI({
|
|
|
50
50
|
...rest
|
|
51
51
|
});
|
|
52
52
|
} catch (error) {
|
|
53
|
-
(
|
|
54
|
-
|
|
53
|
+
if (error instanceof _runApi.AutomationError) {
|
|
54
|
+
(0, _terminal.terminal)(`^r^+Attempt ${i + 1} failed ^:^+${apiName}^:: ^R${error.error.message}^:\n`);
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
throw error;
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
})();
|
|
@@ -116,7 +119,7 @@ async function handleApiResult({
|
|
|
116
119
|
(0, _terminal.terminal)(`${JSON.stringify(result, null, 2)}\n`);
|
|
117
120
|
}
|
|
118
121
|
if (payloadToAppend && payloadToAppend.length > 0) {
|
|
119
|
-
(0, _terminal.terminal)(`^+^gExtended payloads:^ ^/^G(This will only take effect if this API run was part of a job.)^:\n
|
|
122
|
+
(0, _terminal.terminal)(`^+^gExtended payloads:^ ^/^G(This will only take effect if this API run was part of a job.)^:\n`);
|
|
120
123
|
(0, _terminal.terminal)(`${JSON.stringify(payloadToAppend, null, 2)}\n`);
|
|
121
124
|
}
|
|
122
125
|
return;
|
|
@@ -163,7 +166,7 @@ async function attemptApi({
|
|
|
163
166
|
});
|
|
164
167
|
if (runApiResult.isErr()) {
|
|
165
168
|
if (runApiResult.error instanceof _runApi.AutomationError) {
|
|
166
|
-
throw runApiResult.error
|
|
169
|
+
throw runApiResult.error;
|
|
167
170
|
}
|
|
168
171
|
throw new _helpers.CLIError(`An error occurred while running the API: ${runApiResult.error.message}`);
|
|
169
172
|
}
|