@sasjs/cli 3.8.8 → 3.8.9
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.
|
@@ -130,12 +130,32 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
|
|
|
130
130
|
case 2:
|
|
131
131
|
output = '';
|
|
132
132
|
if (res === null || res === void 0 ? void 0 : res.result)
|
|
133
|
-
|
|
133
|
+
res = res.result;
|
|
134
|
+
// In sasjs request debug is always on, meaning the response object always contains the log
|
|
135
|
+
// This log goes to a seperate .log file, and should not be added to the output file (*.json)
|
|
136
|
+
// Therefore, we delete it now from the result object
|
|
137
|
+
else if (res === null || res === void 0 ? void 0 : res.log)
|
|
138
|
+
delete res.log;
|
|
139
|
+
// Sometimes res.result contains the log (eg when there is a SAS error)
|
|
140
|
+
// Here we make sure that the content in the output file (*.json) will be in json format
|
|
141
|
+
if (typeof res === 'string') {
|
|
142
|
+
try {
|
|
143
|
+
output = JSON.parse(res);
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
(0, displayResult_1.displayError)('Error parsing response. JSON is expected.');
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
output = res;
|
|
151
|
+
}
|
|
152
|
+
if (!!!output) return [3 /*break*/, 4];
|
|
134
153
|
return [4 /*yield*/, writeOutput(outputPathParam, output, isLocal)];
|
|
135
154
|
case 3:
|
|
136
155
|
_a.sent();
|
|
137
|
-
|
|
138
|
-
case 4:
|
|
156
|
+
_a.label = 4;
|
|
157
|
+
case 4: return [4 /*yield*/, saveLogFile(sasjs, sasJobLocation, logFile, jobPath)];
|
|
158
|
+
case 5:
|
|
139
159
|
_a.sent();
|
|
140
160
|
result = true;
|
|
141
161
|
return [2 /*return*/];
|
|
@@ -143,6 +163,7 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
|
|
|
143
163
|
});
|
|
144
164
|
}); })
|
|
145
165
|
.catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
|
|
166
|
+
var error;
|
|
146
167
|
return __generator(this, function (_a) {
|
|
147
168
|
switch (_a.label) {
|
|
148
169
|
case 0:
|
|
@@ -150,7 +171,10 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
|
|
|
150
171
|
(0, utils_2.displaySasjsRunnerError)(configJson.username);
|
|
151
172
|
}
|
|
152
173
|
else {
|
|
153
|
-
|
|
174
|
+
error = {};
|
|
175
|
+
if (err.message)
|
|
176
|
+
error.message = err.message;
|
|
177
|
+
(0, displayResult_1.displayError)(error, 'An error occurred while executing the request.');
|
|
154
178
|
}
|
|
155
179
|
return [4 /*yield*/, saveLogFile(sasjs, sasJobLocation, logFile, jobPath)];
|
|
156
180
|
case 1:
|
package/package.json
CHANGED