summary refs log tree commit diff
path: root/synapse/util/async_helpers.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-09-19 11:05:21 +0100
committerErik Johnston <erik@matrix.org>2018-09-19 11:07:29 +0100
commit9407bcf37a99ebb72eef73e19632cdcf5964c968 (patch)
tree43baf821e36043fc99f85b950c0be277da74f13c /synapse/util/async_helpers.py
parentRun canceller first to allow it to generate correct error (diff)
downloadsynapse-9407bcf37a99ebb72eef73e19632cdcf5964c968.tar.xz
Replace custom DeferredTimeoutError with defer.TimeoutError
Diffstat (limited to 'synapse/util/async_helpers.py')
-rw-r--r--synapse/util/async_helpers.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/synapse/util/async_helpers.py b/synapse/util/async_helpers.py
index 2b2e85ecb7..ec7b2c9672 100644
--- a/synapse/util/async_helpers.py
+++ b/synapse/util/async_helpers.py
@@ -374,16 +374,10 @@ class ReadWriteLock(object):
         defer.returnValue(_ctx_manager())
 
 
-class DeferredTimeoutError(Exception):
-    """
-    This error is raised by default when a L{Deferred} times out.
-    """
-
-
 def _cancelled_to_timed_out_error(value, timeout):
     if isinstance(value, failure.Failure):
         value.trap(CancelledError)
-        raise DeferredTimeoutError(timeout, "Deferred")
+        raise defer.TimeoutError(timeout, "Deferred")
     return value
 
 
@@ -408,7 +402,7 @@ def timeout_deferred(deferred, timeout, reactor, on_timeout_cancel=None):
             the timeout.
 
             The default callable (if none is provided) will translate a
-            CancelledError Failure into a DeferredTimeoutError.
+            CancelledError Failure into a defer.TimeoutError.
 
     Returns:
         Deferred
@@ -427,7 +421,7 @@ def timeout_deferred(deferred, timeout, reactor, on_timeout_cancel=None):
             logger.exception("Canceller failed during timeout")
 
         if not new_d.called:
-            new_d.errback(DeferredTimeoutError(timeout, "Deferred"))
+            new_d.errback(defer.TimeoutError(timeout, "Deferred"))
 
     delayed_call = reactor.callLater(timeout, time_it_out)