Mercurial > libervia-backend
changeset 2990:6959c71ab8bf
plugin XEP-0045: log "failure" on configure error
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 06 Jul 2019 15:51:48 +0200 |
parents | c13333fcde5e |
children | f4590ca2acff |
files | sat/core/sat_main.py sat/plugins/plugin_xep_0045.py |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/core/sat_main.py Sat Jul 06 15:50:55 2019 +0200 +++ b/sat/core/sat_main.py Sat Jul 06 15:51:48 2019 +0200 @@ -596,12 +596,13 @@ """ return unicode(self.memory.getConfig(section, name, "")) - def logErrback(self, failure_): - """generic errback logging + def logErrback(self, failure_, msg=_(u"Unexpected error: {failure_}")): + """Generic errback logging + @param msg(unicode): error message ("failure_" key will be use for format) can be used as last errback to show unexpected error """ - log.error(_(u"Unexpected error: {}".format(failure_))) + log.error(msg.format(failure_=failure_)) return failure_ # namespaces
--- a/sat/plugins/plugin_xep_0045.py Sat Jul 06 15:50:55 2019 +0200 +++ b/sat/plugins/plugin_xep_0045.py Sat Jul 06 15:51:48 2019 +0200 @@ -237,7 +237,8 @@ # a proper configuration management should be done log.debug(_(u"room locked !")) d = client._muc_client.configure(room.roomJID, {}) - d.addErrback(lambda __: log.error(_(u'Error while configuring the room'))) + d.addErrback(self.host.logErrback, + msg=_(u'Error while configuring the room: {failure_}')) return room.fully_joined def _joinEb(self, failure, client, room_jid, nick, password):