# HG changeset patch # User Goffi # Date 1612428893 -3600 # Node ID 96342e7e9f5d68f56209598017e2ff328f49c145 # Parent f6a225476165464ae0296cf2e6ad102d85492820 privilege: log error when `requestInfo` is failing diff -r f6a225476165 -r 96342e7e9f5d sat_pubsub/privilege.py --- a/sat_pubsub/privilege.py Thu Feb 04 09:38:17 2021 +0100 +++ b/sat_pubsub/privilege.py Thu Feb 04 09:54:53 2021 +0100 @@ -30,7 +30,7 @@ from twisted.python import failure from twisted.internet import defer from twisted.words.xish import domish -from twisted.words.protocols.jabber import jid +from twisted.words.protocols.jabber import jid, error import time FORWARDED_NS = 'urn:xmpp:forward:0' @@ -258,10 +258,19 @@ if disco_tuple not in self.hash_map: # first time we se this hash, what is behind it? - infos = yield self.requestInfo(from_jid) - self.hash_map[disco_tuple] = { - 'notify': {f[:-7] for f in infos.features if f.endswith('+notify')}, - 'infos': infos + try: + infos = yield self.requestInfo(from_jid) + except error.StanzaError as e: + log.msg( + f"WARNING: can't request disco info for {from_jid!r} (presence: " + f"{presence_type}): {e}" + ) + else: + self.hash_map[disco_tuple] = { + 'notify': { + f[:-7] for f in infos.features if f.endswith('+notify') + }, + 'infos': infos } # jid_caps must be filled only after hash_map is set, to be sure that