add invalid response handling for /api/comment

This commit is contained in:
Akinwale Ariwodola 2018-05-04 02:17:37 +01:00
parent 044674d8d6
commit c851b15000

4
app.js
View file

@ -513,6 +513,10 @@ const replyMessageUsingTemplate = (template, substitutions, sourceMessageFullId,
return callback(e, null);
}
if (!response.json) {
return callback(new Error('Invalid response.'), null);
}
if (response.json.ratelimit > 0 ||
response.json.errors.length > 0) {
return callback(new Error('Rate limited.'), null);