diff --git a/lib/BootBot.js b/lib/BootBot.js index 5df40f8..f31de60 100644 --- a/lib/BootBot.js +++ b/lib/BootBot.js @@ -284,10 +284,14 @@ class BootBot extends EventEmitter { if (res.error) { console.log('Messenger Error received. For more information about error codes, see: https://goo.gl/d76uvB'); console.log(res.error); + throw res.error; } return res; }) - .catch(err => console.log(`Error sending message: ${err}`)); + .catch(err => { + console.log(`Error sending message: ${err}`); + throw err; + }); } /** @@ -339,7 +343,10 @@ class BootBot extends EventEmitter { const url = `https://graph.facebook.com/${this.graphApiVersion}/${userId}?fields=first_name,last_name,profile_pic,locale,timezone,gender&access_token=${this.accessToken}`; return fetch(url) .then(res => res.json()) - .catch(err => console.log(`Error getting user profile: ${err}`)); + .catch(err => { + console.log(`Error getting user profile: ${err}`); + throw err; + }); } /**