Instances of BaseException and family don't provide __module__?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Nov 3 01:39:37 EDT 2007


On Fri, 02 Nov 2007 19:36:05 -0700, Scott Dial wrote:

> I have started working on a new project using ZSI and perhaps one can
> argue this is a bug in ZSI, but I found it odd. The ZSI dispatcher needs
> to catch all exceptions and pass that over to the client; in doing so,
> it passes along the name of the exception that occurred so that the
> client can know more than just "it failed."

I have no opinion on whether the problem you report is a bug in Python or 
ZSI or not, but I'd suggest that passing along the name of the exception 
is not the right way to go about it.

The right way is to pass along the exception itself:

try:
    doSomething()
except Exception, ex:
    sendFault(ex)
    report_error_and_continue()

(Always assuming you want to continue.)

That gives the caller access to as much or as little of the exception as 
it needs.


-- 
Steven.



More information about the Python-list mailing list