add invalid response handling for /api/comment
This commit is contained in:
parent
044674d8d6
commit
c851b15000
1 changed files with 4 additions and 0 deletions
4
app.js
4
app.js
|
@ -513,6 +513,10 @@ const replyMessageUsingTemplate = (template, substitutions, sourceMessageFullId,
|
||||||
return callback(e, null);
|
return callback(e, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!response.json) {
|
||||||
|
return callback(new Error('Invalid response.'), null);
|
||||||
|
}
|
||||||
|
|
||||||
if (response.json.ratelimit > 0 ||
|
if (response.json.ratelimit > 0 ||
|
||||||
response.json.errors.length > 0) {
|
response.json.errors.length > 0) {
|
||||||
return callback(new Error('Rate limited.'), null);
|
return callback(new Error('Rate limited.'), null);
|
||||||
|
|
Loading…
Reference in a new issue