[Twisted-Python] More on PB Copyable Errors

Justin Johnson justinjohnson at gmail.com
Tue Dec 28 15:32:04 EST 2004

I would really like to be able to pass custom exceptions over the wire
in PB.  Previous discussion on this list ended with the conclusion
that it currently isn't possible without hacking a local copy of

I have done that to get the result I want, with minimal testing, and
would like to get some discussion going around this topic.  Attached
are 3 test files, s.py for the server, c.py for the client, and e.py
for the error definitions which are imported by both s.py and c.py. 
If I make the following modification to my local copy of
twisted/spread/pb.py in the CopyableFailure's getStateToCopy method,
the custom error is passed back as I want.

   #state['value'] = str(self.value) # Exception instance
   state['value'] = self.value # Exception instance

I was wondering if there is a reason we wouldn't want to change the
code to check for registered unjellyables for the exception, and
return them (or rather go through the jelly/unjelly process) if they
exist, but return the string representation otherwise.  Maybe that is
more complicated than I realize.

Any thoughts or suggestions on how we might make this possible?

More information about the Twisted-Python mailing list