summary refs log tree commit diff
path: root/synapse/util
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-12 13:14:29 +0100
committerErik Johnston <erik@matrix.org>2015-05-12 13:14:29 +0100
commit95dedb866f04ee4ae034c35130f2a8dc86243fbb (patch)
tree80080d23bffdfd8badb1d4b56cb4dc4884a61d4b /synapse/util
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/logging_co... (diff)
downloadsynapse-95dedb866f04ee4ae034c35130f2a8dc86243fbb.tar.xz
Unwrap defer.gatherResults failures
Diffstat (limited to 'synapse/util')
-rw-r--r--synapse/util/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/util/__init__.py b/synapse/util/__init__.py
index fd3eb1f574..c1a16b639a 100644
--- a/synapse/util/__init__.py
+++ b/synapse/util/__init__.py
@@ -23,6 +23,12 @@ import logging
 logger = logging.getLogger(__name__)
 
 
+def unwrapFirstError(failure):
+    # defer.gatherResults and DeferredLists wrap failures.
+    failure.trap(defer.FirstError)
+    return failure.value.subFailure
+
+
 class Clock(object):
     """A small utility that obtains current time-of-day so that time may be
     mocked during unit-tests.