core (memory): catch exceptions.UnknownEntityError in getMainResource
This commit is contained in:
parent
566de1dd33
commit
939b6ba80b
1 changed files with 6 additions and 1 deletions
|
|
@ -565,6 +565,7 @@ class Memory(object):
|
|||
return (list[unicode]): list of resources
|
||||
|
||||
@raise exceptions.UnknownEntityError: if entity is not in cache
|
||||
@raise ValueError: entity_jid has a resource
|
||||
"""
|
||||
if entity_jid.resource:
|
||||
raise ValueError("getAllResources must be used with a bare jid (got {})".format(entity_jid))
|
||||
|
|
@ -618,7 +619,11 @@ class Memory(object):
|
|||
return None # MUC rooms have no main resource
|
||||
except KeyError: # plugin not found
|
||||
pass
|
||||
resources = self.getAllResources(entity_jid, profile_key)
|
||||
try:
|
||||
resources = self.getAllResources(entity_jid, profile_key)
|
||||
except exceptions.UnknownEntityError:
|
||||
log.warning(u"Entity is not in cache, we can't find any resource")
|
||||
return None
|
||||
priority_resources = []
|
||||
for resource in resources:
|
||||
full_jid = copy.copy(entity_jid)
|
||||
|
|
|
|||
Loading…
Reference in a new issue