Mercurial > libervia-backend
changeset 1493:1285c714a6cc
core (disco): use of failure.Failure when raising FeatureNotFound to avoid a jump in debugger in debug mode
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 25 Aug 2015 16:52:18 +0200 |
parents | 6ec2741b7268 |
children | 74ddb4cc2ff9 |
files | src/memory/disco.py |
diffstat | 1 files changed, 7 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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_)