General default exception handler

Dale Strickland-Clark dale at out-think.NOSPAMco.uk
Mon Dec 4 14:47:53 CET 2000


"Steve Holden" <sholden at holdenweb.com> wrote:

>Dale Strickland-Clark <dale at out-think.NOSPAMco.uk> wrote in message
>news:lj0n2to9vs8bmv3oo49mqgoc6h7esh8t37 at 4ax.com...
>> 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
>raises.
>
>See, for example,
>
>    http://www.webtechniques.com/archives/1998/02/kuchling/
>
>in which Andrew Kuchling describes the basic technique.  This seems to give
>you what you want.
>
>regards
> 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