@@ -35,6 +35,9 @@ const parseAndDownloadArtifacts = async (buildId, data, bsConfig, args, rawArgs,
3535 utils . sendUsageReport ( bsConfig , args , warningMessage , Constants . messageTypes . ERROR , 'build_artifacts_not_found' , buildReportData , rawArgs ) ;
3636 } else {
3737 BUILD_ARTIFACTS_FAIL_COUNT += 1 ;
38+ const errorMsg = `Error downloading build artifacts for ${ sessionId } with error: ${ error } ` ;
39+ logger . debug ( errorMsg ) ;
40+ utils . sendUsageReport ( bsConfig , args , errorMsg , Constants . messageTypes . ERROR , 'build_artifacts_parse_error' , buildReportData , rawArgs ) ;
3841 }
3942 // delete malformed zip if present
4043 let tmpFilePath = path . join ( filePath , fileName ) ;
@@ -102,14 +105,16 @@ const downloadAndUnzip = async (filePath, fileName, url) => {
102105 let tmpFilePath = path . join ( filePath , fileName ) ;
103106 const writer = fs . createWriteStream ( tmpFilePath ) ;
104107
108+ logger . debug ( `Downloading build artifact for: ${ filePath } ` )
105109 return new Promise ( async ( resolve , reject ) => {
106110 request . get ( url ) . on ( 'response' , function ( response ) {
107111
108112 if ( response . statusCode != 200 ) {
109113 if ( response . statusCode === 404 ) {
110114 reject ( Constants . userMessages . DOWNLOAD_BUILD_ARTIFACTS_NOT_FOUND ) ;
111115 }
112- reject ( ) ;
116+ const errorMsg = `Non 200 status code, got status code: ${ response . statusCode } ` ;
117+ reject ( errorMsg ) ;
113118 } else {
114119 //ensure that the user can call `then()` only when the file has
115120 //been downloaded entirely.
0 commit comments