@sasjs/cli 3.8.6 → 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.
@@ -478,8 +478,7 @@ function compileWeb(target) {
478
478
  .then(function () { var _a; return (_a = process.logger) === null || _a === void 0 ? void 0 : _a.success("Web app services have been compiled."); })
479
479
  .catch(function (err) {
480
480
  var _a;
481
- (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('An error has occurred when compiling web app services.');
482
- throw err;
481
+ (_a = process.logger) === null || _a === void 0 ? void 0 : _a.error('An error has occurred when compiling web app services.', err.toString());
483
482
  })];
484
483
  case 2:
485
484
  _c.sent();
@@ -117,6 +117,7 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
117
117
  (0, displayResult_1.displayError)(null, 'Login callback called. Request failed.');
118
118
  }, authConfig)
119
119
  .then(function (res) { return __awaiter(_this, void 0, void 0, function () {
120
+ var output;
120
121
  return __generator(this, function (_a) {
121
122
  switch (_a.label) {
122
123
  case 0:
@@ -127,10 +128,34 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
127
128
  _a.sent();
128
129
  return [2 /*return*/];
129
130
  case 2:
131
+ output = '';
130
132
  if (res === null || res === void 0 ? void 0 : res.result)
131
133
  res = res.result;
132
- return [4 /*yield*/, writeOutput(outputPathParam, res, isLocal)];
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];
153
+ return [4 /*yield*/, writeOutput(outputPathParam, output, isLocal)];
133
154
  case 3:
155
+ _a.sent();
156
+ _a.label = 4;
157
+ case 4: return [4 /*yield*/, saveLogFile(sasjs, sasJobLocation, logFile, jobPath)];
158
+ case 5:
134
159
  _a.sent();
135
160
  result = true;
136
161
  return [2 /*return*/];
@@ -138,6 +163,7 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
138
163
  });
139
164
  }); })
140
165
  .catch(function (err) { return __awaiter(_this, void 0, void 0, function () {
166
+ var error;
141
167
  return __generator(this, function (_a) {
142
168
  switch (_a.label) {
143
169
  case 0:
@@ -145,7 +171,10 @@ function runSasJob(target, isLocal, sasJobLocation, dataFilePath, configFilePath
145
171
  (0, utils_2.displaySasjsRunnerError)(configJson.username);
146
172
  }
147
173
  else {
148
- (0, displayResult_1.displayError)(err, 'An error occurred while executing the request.');
174
+ error = {};
175
+ if (err.message)
176
+ error.message = err.message;
177
+ (0, displayResult_1.displayError)(error, 'An error occurred while executing the request.');
149
178
  }
150
179
  return [4 /*yield*/, saveLogFile(sasjs, sasJobLocation, logFile, jobPath)];
151
180
  case 1:
package/package.json CHANGED
@@ -47,7 +47,7 @@
47
47
  "access": "public"
48
48
  },
49
49
  "dependencies": {
50
- "@sasjs/adapter": "^3.7.13",
50
+ "@sasjs/adapter": "^3.7.14",
51
51
  "@sasjs/core": "4.15.3",
52
52
  "@sasjs/lint": "1.11.2",
53
53
  "@sasjs/utils": "2.36.0",
@@ -94,5 +94,5 @@
94
94
  "typescript": "4.5.4",
95
95
  "util": "0.12.4"
96
96
  },
97
- "version": "3.8.6"
97
+ "version": "3.8.9"
98
98
  }