]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
rrefutil: add trap_deafref utility, to make the callRemote-plus-ignore-DeadReferenceE...
authorBrian Warner <warner@lothar.com>
Tue, 23 Jun 2009 02:08:26 +0000 (19:08 -0700)
committerBrian Warner <warner@lothar.com>
Tue, 23 Jun 2009 02:08:26 +0000 (19:08 -0700)
src/allmydata/util/rrefutil.py

index 097e732a1d04a97524777c66133a21d58630236f..8d2d6c2a562d38904aa0a9d3a899ead45d0c8566 100644 (file)
@@ -1,5 +1,5 @@
 
-from foolscap.api import Violation, RemoteException
+from foolscap.api import Violation, RemoteException, DeadReferenceError
 
 def add_version_to_remote_reference(rref, default):
     """I try to add a .version attribute to the given RemoteReference. I call
@@ -17,3 +17,10 @@ def add_version_to_remote_reference(rref, default):
     d.addCallbacks(_got_version, _no_get_version)
     return d
 
+def trap_and_discard(f, *errorTypes):
+    f.trap(*errorTypes)
+    pass
+
+def trap_deadref(f):
+    f.trap(DeadReferenceError)
+    pass