# HG changeset patch # User Goffi # Date 1440514338 -7200 # Node ID 1285c714a6cce9e51ea0bd761bf5f04163cf923a # Parent 6ec2741b726861293903896499419f93e27679c4 core (disco): use of failure.Failure when raising FeatureNotFound to avoid a jump in debugger in debug mode diff -r 6ec2741b7268 -r 1285c714a6cc src/memory/disco.py --- a/src/memory/disco.py Tue Aug 25 16:51:00 2015 +0200 +++ b/src/memory/disco.py Tue Aug 25 16:52:18 2015 +0200 @@ -25,6 +25,7 @@ from twisted.words.protocols.jabber.error import StanzaError from twisted.internet import defer from twisted.internet import reactor +from twisted.python import failure from sat.core.constants import Const as C from wokkel import disco from base64 import b64encode @@ -86,7 +87,7 @@ """ disco_infos = yield self.getInfos(jid_, profile_key) if not feature in disco_infos.features: - raise exceptions.FeatureNotFound + raise failure.Failure(exceptions.FeatureNotFound) @defer.inlineCallbacks def checkFeatures(self, features, jid_=None, identity=None, profile_key=C.PROF_KEY_NONE): @@ -101,10 +102,10 @@ """ disco_infos = yield self.getInfos(jid_, profile_key) if not set(features).issubset(disco_infos.features): - raise exceptions.FeatureNotFound + raise failure.Failure(exceptions.FeatureNotFound()) if identity is not None and identity not in disco_infos.identities: - raise exceptions.FeatureNotFound + raise failure.Failure(exceptions.FeatureNotFound()) def getInfos(self, jid_=None, profile_key=C.PROF_KEY_NONE): """get disco infos from jid_, filling capability hash if needed @@ -158,10 +159,10 @@ defer.returnValue(items) - def _infosEb(self, failure, entity_jid): - failure.trap(StanzaError) + def _infosEb(self, failure_, entity_jid): + failure_.trap(StanzaError) log.warning(_(u"Error while requesting [%(jid)s]: %(error)s") % {'jid': entity_jid.full(), - 'error': failure.getErrorMessage()}) + 'error': failure_.getErrorMessage()}) def findServiceEntities(self, category, type_, jid_=None, profile_key=C.PROF_KEY_NONE): """Return all available items of an entity which correspond to (category, type_)