Skip to content

Commit

Permalink
chore: don't use JSON.stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
asambstack committed Nov 19, 2024
1 parent 2ede615 commit 8cacbad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/helpers/usageReporting.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,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 @@ -297,7 +297,11 @@ async function send(args) {
};
fileLogger.info(`${JSON.stringify(result)}`);
} catch (error) {
fileLogger.error(JSON.stringify(error.response.data));
if (error.response) {
fileLogger.error(utils.formatRequest(error.response.statusText, error.response, error.response.data));
} else {
fileLogger.error(`Error sending usage data: ${error.message}`);
}
return;
}
}
Expand Down

0 comments on commit 8cacbad

Please sign in to comment.