From a99008b984a00031541d1f281c305562d8aa5b45 Mon Sep 17 00:00:00 2001 From: nioc Date: Sun, 24 Nov 2019 16:39:57 +0100 Subject: [PATCH] Reply to XMPP when outgoing webhook fails --- lib/config/config.json.dist | 1 + lib/xmpp/index.js | 3 +++ test/config.json | 1 + 3 files changed, 5 insertions(+) diff --git a/lib/config/config.json.dist b/lib/config/config.json.dist index b396cf8..5344887 100644 --- a/lib/config/config.json.dist +++ b/lib/config/config.json.dist @@ -46,6 +46,7 @@ "username": "bot@domain-xmpp.ltd", "password": "botPass", "resource": "botservice", + "errorReply": "Oops, something went wrong :(", "rooms": [ { "id": "roomname@conference.domain-xmpp.ltd", diff --git a/lib/xmpp/index.js b/lib/xmpp/index.js index 62971f6..8c6f22c 100644 --- a/lib/xmpp/index.js +++ b/lib/xmpp/index.js @@ -135,6 +135,9 @@ module.exports = (logger, config) => { case 'outgoing_webhook': logger.debug(`Call outgoing webhook: ${xmppHook.args[0]}`) outgoing(logger, config, this, from.toString(), replyTo.toString(), message, type, xmppHook.args[0]) + .catch(() => { + this.send(replyTo.toString(), config.xmpp.errorReply, type) + }) break default: break diff --git a/test/config.json b/test/config.json index fc3534d..31094d5 100644 --- a/test/config.json +++ b/test/config.json @@ -46,6 +46,7 @@ "username": "bot@domain-xmpp.ltd", "password": "botPass", "resource": "botservice", + "errorReply": "Oops, something went wrong :(", "rooms": [ { "id": "roomname@conference.domain-xmpp.ltd",