# HG changeset patch # User souliane # Date 1448467153 -3600 # Node ID c2d96f74105ec70ccf5cd6c5c68c0c3e9acda59c # Parent a125b11af711c21bb79ec31e386d0e28a39bc013 plugin XEP-0060: trap failure when subscription to a node is not possible diff -r a125b11af711 -r c2d96f74105e src/plugins/plugin_xep_0060.py --- a/src/plugins/plugin_xep_0060.py Wed Nov 25 15:35:21 2015 +0100 +++ b/src/plugins/plugin_xep_0060.py Wed Nov 25 16:59:13 2015 +0100 @@ -25,7 +25,7 @@ from sat.tools import sat_defer -from twisted.words.protocols.jabber import jid +from twisted.words.protocols.jabber import jid, error from twisted.internet import defer from wokkel import disco # XXX: tmp.pubsub is actually use instead of wokkel version @@ -244,8 +244,12 @@ except KeyError: subscribe = False + def subscribeEb(failure, service, node): + failure.trap(error.StanzaError) + log.warning("Could not subscribe to node {} on service {}: {}".format(node, unicode(service), unicode(failure.value))) + def doSubscribe(items): - self.subscribe(service, node, profile_key=profile_key) + self.subscribe(service, node, profile_key=profile_key).addErrback(subscribeEb, service, node) return items if subscribe: