mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 07:06:41 +00:00
rrefutil: add trap_deafref utility, to make the callRemote-plus-ignore-DeadReferenceError-plug-log-other-errors pattern easier
This commit is contained in:
parent
699510c8f1
commit
aa23ff9180
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user