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

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Webware-devel mailing list
Webware-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to