General default exception handler

Dale Strickland-Clark dale at
Mon Dec 4 08:47:53 EST 2000

"Steve Holden" <sholden at> wrote:

>Dale Strickland-Clark <dale at> wrote in message
>news:lj0n2to9vs8bmv3oo49mqgoc6h7esh8t37 at
>> We have a substantial set of COM objects in Python that run a Web site.
>> Currently, if an exception is raised, the user gets an unfriendly message
>in their browser and we
>> may never know about it.
>> I want to log all unhandled exceptions but I'd rather not have to put a
>try/except block around
>> every entry point - because there are dozens of them.
>> Is there a general way to catch all unhandled exceptions so I can log them
>and pass back something
>> nice and soothing to the user?
>> I'm planning to use the traceback module to record the exception info.
>> Thanks
>> --
>> Dale Strickland-Clark
>> Out-Think Ltd
>> Business Technology Consultants
>If you're prepared to accept URLs which use an extended path to indicate
>arguments, one poosibility is to direct all requests to a "framework page"
>which then calls the required Python functionality and traps any errors it
>See, for example,
>in which Andrew Kuchling describes the basic technique.  This seems to give
>you what you want.
> Steve
Interesting idea but that won't work in this case. I have to trap the error inside the COM object or
much of the detail is lost.

Dale Strickland-Clark
Out-Think Ltd
Business Technology Consultants

More information about the Python-list mailing list