Skip to content

Commit 1b0b0a2

Browse files
committed
fix: error handling (closes #506)
1 parent 69a1eea commit 1b0b0a2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/lib/stats.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ module.exports.sendToHouston = async client => {
7777
client.log.success('Posted client stats');
7878
client.log.debug(res);
7979
} catch (res) {
80-
client.log.error('An error occurred whilst posting stats:', (await res.json())?.error);
80+
try {
81+
const json = await res.json();
82+
client.log.error('An error occurred whilst posting stats:', json);
83+
} catch (error) {
84+
client.log.error('An error occurred whilst posting stats and the response couldn\'t be parsed');
85+
client.log.error(error.message);
86+
}
8187
client.log.debug(res);
8288
}
8389
};

0 commit comments

Comments
 (0)