@@ -3,6 +3,7 @@ var https = require('https'),
33 fs = require ( 'fs' ) ,
44 path = require ( 'path' ) ,
55 os = require ( 'os' ) ,
6+ util = require ( 'util' ) ,
67 childProcess = require ( 'child_process' ) ,
78 zlib = require ( 'zlib' ) ,
89 HttpsProxyAgent = require ( 'https-proxy-agent' ) ,
@@ -19,7 +20,7 @@ function LocalBinary(){
1920 this . downloadErrorMessage = null ;
2021
2122 this . getSourceUrl = function ( conf , retries ) {
22- /* Request for an endpoint from Rails no more than twice with 5 retries each */
23+ /* Request for an endpoint to download the local binary from Rails no more than twice with 5 retries each */
2324 if ( ! [ 4 , 9 ] . includes ( retries ) && this . sourceURL != null ) {
2425 return this . sourceURL ;
2526 }
@@ -158,7 +159,7 @@ function LocalBinary(){
158159 return that . retryBinaryDownload ( conf , destParentDir , null , retries , binaryPath ) ;
159160 }
160161 } catch ( err ) {
161- that . binaryDownloadError ( 'Download failed with error' , err . getMessage ( ) ) ;
162+ that . binaryDownloadError ( 'Download failed with error' , util . format ( err ) ) ;
162163 return that . retryBinaryDownload ( conf , destParentDir , null , retries , binaryPath ) ;
163164 }
164165 } ;
@@ -211,11 +212,11 @@ function LocalBinary(){
211212 }
212213
213214 response . on ( 'error' , function ( err ) {
214- that . binaryDownloadError ( 'Got Error in binary download response' , err . message ) ;
215+ that . binaryDownloadError ( 'Got Error in binary download response' , util . format ( err ) ) ;
215216 that . retryBinaryDownload ( conf , destParentDir , callback , retries , binaryPath ) ;
216217 } ) ;
217218 fileStream . on ( 'error' , function ( err ) {
218- that . binaryDownloadError ( 'Got Error while downloading binary file' , err . message ) ;
219+ that . binaryDownloadError ( 'Got Error while downloading binary file' , util . format ( err ) ) ;
219220 that . retryBinaryDownload ( conf , destParentDir , callback , retries , binaryPath ) ;
220221 } ) ;
221222 fileStream . on ( 'close' , function ( ) {
@@ -224,7 +225,7 @@ function LocalBinary(){
224225 } ) ;
225226 } ) ;
226227 } ) . on ( 'error' , function ( err ) {
227- that . binaryDownloadError ( 'Got Error in binary downloading request' , err . message ) ;
228+ that . binaryDownloadError ( 'Got Error in binary downloading request' , util . format ( err ) ) ;
228229 that . retryBinaryDownload ( conf , destParentDir , callback , retries , binaryPath ) ;
229230 } ) ;
230231 } ;
0 commit comments