Index: twisted/spread/pb.py =================================================================== --- twisted/spread/pb.py (revision 12811) +++ twisted/spread/pb.py (working copy) @@ -91,6 +91,7 @@ from flavors import ViewPoint from flavors import Viewable from flavors import Copyable +from flavors import Jellyable from flavors import Cacheable from flavors import RemoteCopy from flavors import RemoteCache @@ -886,7 +887,17 @@ netResult = object.remoteMessageReceived(self, message, netArgs, netKw) except Error, e: if answerRequired: - self._sendError(CopyableFailure(e), requestID) + # If the error is Jellyable or explicitly allowed via the + # global security options, send it back and let the code on + # the other end deal with unjellying. + # If it isn't Jellyable, wrap it in a CopyableFailure, which + # ensures it can be unjellied on the other end. We have to + # do this because all errors must be sent back. + eType = type(e).__name__.replace(' ', '_') + if isinstance(e, Jellyable) or globalSecurity.isTypeAllowed(eType): + self._sendError(e, requestID) + else: + self._sendError(CopyableFailure(e), requestID) except: if answerRequired: log.msg("Peer will receive following PB traceback:", isError=True)