Skip to content

Commit

Permalink
fix: error handling (closes #506)
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Jan 21, 2024
1 parent 69a1eea commit 1b0b0a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ module.exports.sendToHouston = async client => {
client.log.success('Posted client stats');
client.log.debug(res);
} catch (res) {
client.log.error('An error occurred whilst posting stats:', (await res.json())?.error);
try {
const json = await res.json();
client.log.error('An error occurred whilst posting stats:', json);
} catch (error) {
client.log.error('An error occurred whilst posting stats and the response couldn\'t be parsed');
client.log.error(error.message);
}
client.log.debug(res);
}
};

0 comments on commit 1b0b0a2

Please sign in to comment.