core (disco): use of failure.Failure when raising FeatureNotFound to avoid a jump in debugger in debug mode
This commit is contained in:
parent
11acf009ee
commit
f41aed19af
1 changed files with 7 additions and 6 deletions
|
|
@ -25,6 +25,7 @@ from twisted.words.protocols.jabber import jid
|
|||
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 @@ class Discovery(object):
|
|||
"""
|
||||
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 @@ class Discovery(object):
|
|||
"""
|
||||
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 @@ class Discovery(object):
|
|||
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_)
|
||||
|
|
|
|||
Loading…
Reference in a new issue