From 7ed375f6f55b259d8242117ce728365259c24b87 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Wed, 15 May 2024 15:53:41 -0700 Subject: [PATCH] chore: Show valid error messages on Inbox creation (#9474) At the moment, when creating an inbox for Whatsapp, Telegram, etc., we show a generic error message saying that inbox creation failed. This PR will show the error messages directly from the API call, which is more helpful as it says if the error is due to the provided credentials. --- .../dashboard/settings/inbox/channels/360DialogWhatsapp.vue | 4 +++- .../dashboard/settings/inbox/channels/CloudWhatsapp.vue | 4 +++- .../routes/dashboard/settings/inbox/channels/Telegram.vue | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/360DialogWhatsapp.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/360DialogWhatsapp.vue index ded9142db..ebac2a2d1 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/360DialogWhatsapp.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/360DialogWhatsapp.vue @@ -111,7 +111,9 @@ export default { }, }); } catch (error) { - this.showAlert(this.$t('INBOX_MGMT.ADD.WHATSAPP.API.ERROR_MESSAGE')); + this.showAlert( + error.message || this.$t('INBOX_MGMT.ADD.WHATSAPP.API.ERROR_MESSAGE') + ); } }, }, diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/CloudWhatsapp.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/CloudWhatsapp.vue index a6253e516..dd320dd17 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/CloudWhatsapp.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/CloudWhatsapp.vue @@ -155,7 +155,9 @@ export default { }, }); } catch (error) { - this.showAlert(this.$t('INBOX_MGMT.ADD.WHATSAPP.API.ERROR_MESSAGE')); + this.showAlert( + error.message || this.$t('INBOX_MGMT.ADD.WHATSAPP.API.ERROR_MESSAGE') + ); } }, }, diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Telegram.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Telegram.vue index 1f677bd66..c7cbaeb4a 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Telegram.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/channels/Telegram.vue @@ -86,7 +86,8 @@ export default { }); } catch (error) { this.showAlert( - this.$t('INBOX_MGMT.ADD.TELEGRAM_CHANNEL.API.ERROR_MESSAGE') + error.message || + this.$t('INBOX_MGMT.ADD.TELEGRAM_CHANNEL.API.ERROR_MESSAGE') ); } },