summary refs log tree commit diff
path: root/synapse/logging/context.py
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-03-31 15:18:41 +0100
committerGitHub <noreply@github.com>2020-03-31 15:18:41 +0100
commit60adcbed919afd5c85442775eca822fec43d816d (patch)
treee3eb78f52c32da097193fa9b9869e9b6cd1e1f52 /synapse/logging/context.py
parentFill in the 'default' field for user-defined push rules (#6639) (diff)
downloadsynapse-60adcbed919afd5c85442775eca822fec43d816d.tar.xz
Fix "'NoneType' has no attribute start|stop" logcontext errors (#7181)
Fixes #7179.
Diffstat (limited to '')
-rw-r--r--synapse/logging/context.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/synapse/logging/context.py b/synapse/logging/context.py
index a8eafb1c7c..3254d6a8df 100644
--- a/synapse/logging/context.py
+++ b/synapse/logging/context.py
@@ -539,6 +539,11 @@ def set_current_context(context: LoggingContextOrSentinel) -> LoggingContextOrSe
     Returns:
         The context that was previously active
     """
+    # everything blows up if we allow current_context to be set to None, so sanity-check
+    # that now.
+    if context is None:
+        raise TypeError("'context' argument may not be None")
+
     current = current_context()
 
     if current is not context: