add response error handling for retrieveUnreadMessages

This commit is contained in:
Akinwale Ariwodola 2018-01-23 12:32:50 +01:00
parent adc253045b
commit 044674d8d6

4
app.js
View file

@ -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);
});
};