# HG changeset patch # User Goffi # Date 1448553618 -3600 # Node ID a40124e03bafb0e12bc0e3d3ae8dac080602c5c8 # Parent 59a94105b1382c612bed213575c335b62c2e7265 core (memory): catch exceptions.UnknownEntityError in getMainResource diff -r 59a94105b138 -r a40124e03baf src/memory/memory.py --- a/src/memory/memory.py Thu Nov 26 16:04:45 2015 +0100 +++ b/src/memory/memory.py Thu Nov 26 17:00:18 2015 +0100 @@ -565,6 +565,7 @@ 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 @@ 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)