fix: error handling (closes #506)

This commit is contained in:
Isaac 2024-01-21 02:30:47 +00:00
parent 69a1eea7c7
commit 1b0b0a22f9
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33

View File

@ -77,7 +77,13 @@ module.exports.sendToHouston = async client => {
client.log.success('Posted client stats'); client.log.success('Posted client stats');
client.log.debug(res); client.log.debug(res);
} catch (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); client.log.debug(res);
} }
}; };