summaryrefslogtreecommitdiff
path: root/slixmpp/util
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2019-02-02 17:42:24 +0100
committermathieui <mathieui@mathieui.net>2019-02-02 17:42:24 +0100
commitb42fafabb480db0653226a224006dae28c489665 (patch)
treeda1cf27bfff0fe86f11eede9ac90f39e9bb75eba /slixmpp/util
parent3a44ec8f15c1d6267f6838b21b210d844202762c (diff)
downloadslixmpp-b42fafabb480db0653226a224006dae28c489665.tar.gz
slixmpp-b42fafabb480db0653226a224006dae28c489665.tar.bz2
slixmpp-b42fafabb480db0653226a224006dae28c489665.tar.xz
slixmpp-b42fafabb480db0653226a224006dae28c489665.zip
Make the cache encode and decode not crash if something goes wrong
Diffstat (limited to 'slixmpp/util')
-rw-r--r--slixmpp/util/cache.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/slixmpp/util/cache.py b/slixmpp/util/cache.py
index 055163d1..09495841 100644
--- a/slixmpp/util/cache.py
+++ b/slixmpp/util/cache.py
@@ -84,7 +84,10 @@ class FileSystemStorage:
log.debug('%s not present in cache', key)
except OSError:
log.debug('Failed to read %s from cache:', key, exc_info=True)
- return None
+ except Exception:
+ log.debug('Failed to decode %s from cache:', key, exc_info=True)
+ log.debug('Removing %s entry', key)
+ self._remove(directory, key)
def _store(self, directory, key, value):
filename = os.path.join(directory, key.replace('/', '_'))
@@ -96,6 +99,8 @@ class FileSystemStorage:
except OSError:
log.debug('Failed to store %s to cache:', key, exc_info=True)
return False
+ except Exception:
+ log.debug('Failed to encode %s to cache:', key, exc_info=True)
def _remove(self, directory, key):
filename = os.path.join(directory, key.replace('/', '_'))