diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue index e06cdb239..ff831281b 100644 --- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue +++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue @@ -347,7 +347,10 @@ export default { await this.$store.dispatch('sendMessage', messagePayload); this.$emit('scrollToMessage'); } catch (error) { - // Error + const errorMessage = + error?.response?.data?.error || + this.$t('CONVERSATION.MESSAGE_ERROR'); + this.showAlert(errorMessage); } this.hideEmojiPicker(); } diff --git a/app/javascript/dashboard/i18n/locale/en/conversation.json b/app/javascript/dashboard/i18n/locale/en/conversation.json index 42a25e897..d9f4eeba4 100644 --- a/app/javascript/dashboard/i18n/locale/en/conversation.json +++ b/app/javascript/dashboard/i18n/locale/en/conversation.json @@ -84,6 +84,7 @@ "CHANGE_AGENT": "Conversation Assignee changed", "CHANGE_TEAM": "Conversation team changed", "FILE_SIZE_LIMIT": "File exceeds the {MAXIMUM_FILE_UPLOAD_SIZE} attachment limit", + "MESSAGE_ERROR": "Unable to send this message, please try again later", "SENT_BY": "Sent by:", "ASSIGNMENT": { "SELECT_AGENT": "Select Agent", diff --git a/app/javascript/dashboard/store/modules/conversations/actions.js b/app/javascript/dashboard/store/modules/conversations/actions.js index 0415d8724..2af6f8130 100644 --- a/app/javascript/dashboard/store/modules/conversations/actions.js +++ b/app/javascript/dashboard/store/modules/conversations/actions.js @@ -155,6 +155,7 @@ const actions = { }, sendMessage: async ({ commit }, data) => { + // eslint-disable-next-line no-useless-catch try { const pendingMessage = createPendingMessage(data); commit(types.default.ADD_MESSAGE, pendingMessage); @@ -164,7 +165,7 @@ const actions = { status: MESSAGE_STATUS.SENT, }); } catch (error) { - // Handle error + throw error; } },