From c851b15000c5e1662d6ebfddca8d4d8e5c8067cb Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 4 May 2018 02:17:37 +0100 Subject: [PATCH] add invalid response handling for /api/comment --- app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.js b/app.js index 47b94cb..6f0daa9 100644 --- a/app.js +++ b/app.js @@ -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);