Skip to content

Commit 3198df3

Browse files
committed
PR Review Changes
1 parent ea7c4c6 commit 3198df3

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

lib/Local.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var childProcess = require('child_process'),
22
os = require('os'),
33
fs = require('fs'),
4+
util = require('util'),
45
path = require('path'),
56
running = require('is-running'),
67
LocalBinary = require('./LocalBinary'),
@@ -59,7 +60,7 @@ function Local(){
5960
return;
6061
}
6162
}catch(error){
62-
const binaryDownloadErrorMessage = `Error while trying to execute binary: ${error}`;
63+
const binaryDownloadErrorMessage = `Error while trying to execute binary: ${util.format(error)}`;
6364
console.error(binaryDownloadErrorMessage);
6465
if(that.retriesLeft > 0) {
6566
console.log('Retrying Binary Download. Retries Left', that.retriesLeft);
@@ -90,7 +91,7 @@ function Local(){
9091
that.opcode = 'start';
9192
that.tunnel = childProcess.execFile(that.binaryPath, that.getBinaryArgs(), function(error, stdout, stderr){
9293
if(error) {
93-
const binaryDownloadErrorMessage = `Error while trying to execute binary: ${error}`;
94+
const binaryDownloadErrorMessage = `Error while trying to execute binary: ${util.format(error)}`;
9495
console.error(binaryDownloadErrorMessage);
9596
if(that.retriesLeft > 0) {
9697
console.log('Retrying Binary Download. Retries Left', that.retriesLeft);

lib/LocalBinary.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
};

lib/fetchDownloadSourceUrl.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const authToken = process.argv[2], proxyHost = process.argv[5], proxyPort = proc
66

77
let body = '', data = {'auth_token': authToken};
88
const options = {
9-
// hostname: 'local.browserstack.com',
10-
hostname: 'k8s-devlocal.bsstag.com',
9+
hostname: 'local.browserstack.com',
1110
port: 443,
1211
path: '/binary/api/v1/endpoint',
1312
method: 'POST',

0 commit comments

Comments
 (0)