[fxruby-users] FXRuby default error handler
philippe.lang at attiksystem.ch
Tue Oct 9 10:51:13 EDT 2007
fxruby-users-bounces at rubyforge.org wrote:
> Philippe Lang wrote:
>> I'm using FXRuby for building a database front-end. I have quite a
>> lot of classes now, made up of multiple methods each. Most of the
>> time I use rescue blocks in case an exception is raised by the
>> framemork. But doing that in every method of every class is really
>> If an exception is raised from a method without a rescue block, the
>> problem is that my application quits, since the application "run"
>> method stops.
>> $app = MyApp.new
>> rescue Exception => e
>> DbError.show("", e)
>> I was wondering if we could define some sort of "default error
>> handler" for errors raised from the framework, in order to avoid
>> both the application crash, and the "one rescue per method"
> That's a good question.
> I usually just try to make "one rescue per method" as painless as
> possible, by writing wrapper methods. Still, that's "one wrapper per
> method", which is only a slight improvement.
Lyle, do you think it would be possible to add this feature to the FXApp
class: the ability to register some sort of "rescue handler", that can
intercept in the "run" method the exceptions that would otherwise crash
the application? For compatitility, the default handler could simply
raise the exception again, which is what the framework is doing now.
This would be really useful.
More information about the fxruby-users