@@ -3,6 +3,7 @@ var https = require('https'),
3
3
fs = require ( 'fs' ) ,
4
4
path = require ( 'path' ) ,
5
5
os = require ( 'os' ) ,
6
+ util = require ( 'util' ) ,
6
7
childProcess = require ( 'child_process' ) ,
7
8
zlib = require ( 'zlib' ) ,
8
9
HttpsProxyAgent = require ( 'https-proxy-agent' ) ,
@@ -19,7 +20,7 @@ function LocalBinary(){
19
20
this . downloadErrorMessage = null ;
20
21
21
22
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 */
23
24
if ( ! [ 4 , 9 ] . includes ( retries ) && this . sourceURL != null ) {
24
25
return this . sourceURL ;
25
26
}
@@ -158,7 +159,7 @@ function LocalBinary(){
158
159
return that . retryBinaryDownload ( conf , destParentDir , null , retries , binaryPath ) ;
159
160
}
160
161
} catch ( err ) {
161
- that . binaryDownloadError ( 'Download failed with error' , err . getMessage ( ) ) ;
162
+ that . binaryDownloadError ( 'Download failed with error' , util . format ( err ) ) ;
162
163
return that . retryBinaryDownload ( conf , destParentDir , null , retries , binaryPath ) ;
163
164
}
164
165
} ;
@@ -211,11 +212,11 @@ function LocalBinary(){
211
212
}
212
213
213
214
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 ) ) ;
215
216
that . retryBinaryDownload ( conf , destParentDir , callback , retries , binaryPath ) ;
216
217
} ) ;
217
218
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 ) ) ;
219
220
that . retryBinaryDownload ( conf , destParentDir , callback , retries , binaryPath ) ;
220
221
} ) ;
221
222
fileStream . on ( 'close' , function ( ) {
@@ -224,7 +225,7 @@ function LocalBinary(){
224
225
} ) ;
225
226
} ) ;
226
227
} ) . 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 ) ) ;
228
229
that . retryBinaryDownload ( conf , destParentDir , callback , retries , binaryPath ) ;
229
230
} ) ;
230
231
} ;
0 commit comments