Skip to content

Commit afa7640

Browse files
SouravSourav
authored andcommitted
add loglines only on failure
1 parent 53e5d81 commit afa7640

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

bin/helpers/buildArtifacts.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ const sendUpdatesToBstack = async (bsConfig, buildId, args, options, rawArgs) =>
162162
request.post(options, function (err, resp, data) {
163163
if(err) {
164164
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'api_failed_build_artifacts_status_update', null, rawArgs);
165+
logger.error(utils.formatRequest(err, resp, body));
165166
reject(err);
166167
} else {
167168
try {
@@ -203,6 +204,7 @@ exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs) => {
203204
let buildDetails = null;
204205
request.get(options, async function (err, resp, body) {
205206
if(err) {
207+
logger.error(utils.formatRequest(err, resp, body));
206208
utils.sendUsageReport(bsConfig, args, err, Constants.messageTypes.ERROR, 'api_failed_build_artifacts', null, rawArgs);
207209
process.exitCode = Constants.ERROR_EXIT_CODE;
208210
} else {
@@ -211,6 +213,7 @@ exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs) => {
211213
if(resp.statusCode != 200) {
212214
logger.error('Downloading the build artifacts failed.');
213215
logger.error(`Error: Request failed with status code ${resp.statusCode}`)
216+
logger.error(utils.formatRequest(err, resp, body));
214217
utils.sendUsageReport(bsConfig, args, buildDetails, Constants.messageTypes.ERROR, 'api_failed_build_artifacts', null, rawArgs);
215218
process.exitCode = Constants.ERROR_EXIT_CODE;
216219
} else {
@@ -241,6 +244,7 @@ exports.downloadBuildArtifacts = async (bsConfig, buildId, args, rawArgs) => {
241244
}
242245
utils.sendUsageReport(bsConfig, args, err, messageType, errorCode, null, rawArgs);
243246
logger.error(`Error: Request failed with status code ${resp.statusCode}`)
247+
logger.error(utils.formatRequest(err, resp, body));
244248
process.exitCode = Constants.ERROR_EXIT_CODE;
245249
}
246250
}

0 commit comments

Comments
 (0)