Skip to content

Commit

Permalink
Merge branch 'axios-master-without-speedboats' of github.com:browsers…
Browse files Browse the repository at this point in the history
…tack/browserstack-cypress-cli into ats_fixes
  • Loading branch information
KrishnaSuravarapu committed Nov 20, 2024
2 parents da25bb1 + 0ea68a9 commit d3dd8d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions bin/helpers/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ exports.truncateString = (field, truncateSizeInBytes) => {
exports.setAxiosProxy = (axiosConfig) => {
if (process.env.HTTP_PROXY || process.env.HTTPS_PROXY) {
const httpProxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY
axiosConfig.proxy = false;
axiosConfig.httpsAgent = new HttpsProxyAgent(httpProxy);
};
};
Expand Down
8 changes: 6 additions & 2 deletions bin/helpers/usageReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ async function send(args) {
retries: 3,
retryDelay: 2000,
retryCondition: (error) => {
return (error.response.status === 503 || error.response.status === 500)
return utils.isNotUndefined(error.response) && (error.response.status === 503 || error.response.status === 500)
}
});
try {
Expand All @@ -350,7 +350,11 @@ async function send(args) {
};
fileLogger.info(`${JSON.stringify(result)}`);
} catch (error) {
fileLogger.error(JSON.stringify(error.response.data));
if (error.response) {
fileLogger.error(JSON.stringify(error.response.data));
} else {
fileLogger.error(`Error sending usage data: ${error.message}`);
}
return;
}
}
Expand Down

0 comments on commit d3dd8d7

Please sign in to comment.