From d73e21516425ee4de9404637aac9ea3102e19610 Mon Sep 17 00:00:00 2001 From: Seyyed Parsa Neshaei Date: Mon, 31 Jan 2022 21:42:01 +0330 Subject: [PATCH] Fixed issue #159 - Exceptions are swallowed by BootBot --- lib/BootBot.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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; + }); } /**