thanks for the response Christoph.
Inheriting from Exception is probably good advice, and i'll just patch
my version of webware to handle things differently as i audit my code
to make updates to exception handling.
that's probably what i get for trying to update to version 1.0
straight from a 6 year old version of trunk. =)
no need to change the functionality on my account; especially if it
was there in recent versions... perhaps mentioning this on the list
will helps someone else in the future.
On Mon, Dec 15, 2008 at 3:19 AM, Christoph Zwerschke <cito@...> wrote:
> Jehiah Czebotar schrieb:
>> Is there a reason that the WebKit/Application.py code (lines 665-705)
>> only handles a few specific types of errors, and doesn't enter the
>> error handling code for all unknown errors?
>> I am working on upgrading to 1.0 and i realized in testing that my
>> application logic code that raises a custom error (ie: raise "my
>> error") will not trigger the user getting an error page as it isn't a
>> class that inherits from Exception. This seems different to me than
>> the functionality in the previous version i was using.
> The reason is that catching all exceptions would also catch system
> exceptions such as SystemExit and KeyboardInterrupt which we do not want
> the application to handle as normal errors.
> It has been recommended for a long time already that all exceptions
> (that should not be handled at top level) should inherit from Exception.
> This is now even required in Python 3.0. String exceptions such as raise
> "my error" are even worse, they are already forbidden in Python 2.6.
> I agree with you that Webware 1.0, since it tries to be very backward
> compatible, should also catch other exceptions, but unfortunately,
> nobody ever complained about the new behavior that was already in 0.9.3
> and 0.9.4, so it stayed in 1.0. Anyway, I will fix that in the 1.0
> branch, i.e. catch everything and filter out and reraise the top level
> exceptions manually instead of using the "except Exception:" idiom.
> But to make your app future-proof I recommend that you replace every
> occurence of raise "string" in your app with raise Exception("string")
> and let all your exceptions inherit from Exception as the base class.
> -- Christoph