From 044674d8d6d17f66cade364556cd9f660a1490d3 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Tue, 23 Jan 2018 12:32:50 +0100 Subject: [PATCH] add response error handling for retrieveUnreadMessages --- app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.js b/app.js index 67a6da5..47b94cb 100644 --- a/app.js +++ b/app.js @@ -115,6 +115,10 @@ const retrieveUnreadMessages = (accessToken, callback) => { return callback(e, null); } + if (response.error) { + return callback(new Error(response.message)); + } + return callback(null, response.data.children); }); };