[Twisted-Python] Clarification on returning exceptions via Perspective Broker

Matt Bennett matt at bennett.name
Thu Aug 13 10:32:18 EDT 2009


Hi all,

I'm using the Perspective Broker to run functions on various remote
servers, and trying to pass exceptions raised in the remote functions
back to the client.

My exceptions subclass pb.Error, which means tracebacks are suppressed
on the server and errbacks triggered on the client, exactly as I'd
hoped. What I'm confused about though, is why the
serialization/deserialization process reduces my nice structured
exception into a mere string. Isn't PB's raison d'être to allow you to
send fully formed Python classes over the wire?

I'm not 100% convinced that I've not misinterpreted something, but
assuming that pb.Error subclasses are indeed reduced string
representations, I'd appreciate some insight into why PB behaves this
way. I have experimented with returning a standard Exception subclass
to the client, but what it receives is "Unpersistable ... instance
deemed insecure", which I guess has something to do with the design
rationale, but I don't know enough to understand why.

Finally, is there a standard workaround to this that allows structured
data to be returned as or along with the exception, rather than having
to generate structured text as the string representation and then
rebuild the object at the other end?

Many thanks,
Matt.



More information about the Twisted-Python mailing list