summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2015-08-10 14:07:08 +0100
committerMark Haines <mark.haines@matrix.org>2015-08-10 14:07:17 +0100
commit559c51debcf5402cd5999aa1afb854b34e9de363 (patch)
treec74a421dacebba5c32bba2d6f57eae06771bf608
parentMerge pull request #215 from matrix-org/erikj/cache_varargs_interface (diff)
downloadsynapse-559c51debcf5402cd5999aa1afb854b34e9de363.tar.xz
Use TypeError instead of ValueError and give a nicer error mesasge
when someone calls Cache.invalidate with the wrong type.
Diffstat (limited to '')
-rw-r--r--synapse/storage/_base.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py
index e76ee2779a..73eea157a4 100644
--- a/synapse/storage/_base.py
+++ b/synapse/storage/_base.py
@@ -116,7 +116,9 @@ class Cache(object):
     def invalidate(self, key):
         self.check_thread()
         if not isinstance(key, tuple):
-            raise ValueError("keyargs must be a tuple.")
+            raise TypeError(
+                "The cache key must be a tuple not %r" % (type(key),)
+            )
 
         # Increment the sequence number so that any SELECT statements that
         # raced with the INSERT don't update the cache (SYN-369)