From b17579501f0e63ff0889a06a7f2bb50cb55521c0 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Thu, 23 Aug 2018 11:03:17 +0200 Subject: [PATCH] Provide error output to user when encrypted message can't be sent updates #497 --- src/converse-omemo.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/converse-omemo.js b/src/converse-omemo.js index 5b3487928..b2657c0ea 100644 --- a/src/converse-omemo.js +++ b/src/converse-omemo.js @@ -397,13 +397,21 @@ }, sendMessage (attrs) { - const { _converse } = this.__super__; + const { _converse } = this.__super__, + { __ } = _converse; if (this.get('omemo_active')) { const message = this.messages.create(attrs); this.getBundlesAndBuildSessions() .then(devices => this.createOMEMOMessageStanza(message, devices)) .then(stanza => this.sendMessageStanza(stanza)) - .catch(_.partial(_converse.log, _, Strophe.LogLevel.ERROR)); + .catch((e) => { + this.messages.create({ + 'message': __("Sorry, could not send the message due to an error.") + ` ${e.message}`, + 'type': 'error', + }); + converse.log(e, Strophe.LogLevel.ERROR); + }); + } else { return this.__super__.sendMessage.apply(this, arguments); }