Hello,
There are a few situations when ruby code runs in a way that the raised
exceptions are swallowed by the ruby/tk code (I suppose). I didn’t look
much after it, but one of this is when ruby code runs as an 'after’
callback.
Can I somehow globally catch these exceptions? Because if I forget to
place a begin…rescue…TkDialog envelope to the code, these exceptions
are easily overlooked.
Thanks:
Ferenc
There are a few situations when ruby code runs in a way that the raised
exceptions are swallowed by the ruby/tk code (I suppose). I didn’t look
much after it, but one of this is when ruby code runs as an ‘after’
callback.
TkAfter had a bug on treatment of TkAfter#cancel_on_exception=(mode).
I fixed it on CVS.
If you set TkAfter#cancel_on_exception = false, Tk will show an error
dialog box when the after callback cause an exception.
The default value of cancel_on_exception is true.
Why? 
Why should an uncatched exception be quiet? I think that is a
programming error, more often than not. Although, I mostly use TkAfter
for ‘after idle’, not for repeating tasks, so it is possible that this
alters my point of view.
Thanks for the bugfix.
Ferenc
For ‘after idle’ only, there is ‘Tk.after_idle’ method.
It will show an error dialog, when its callback procedure causes an
exception.
And what about, say, TkEntry’s validatecommand functions? It seems that
they work similarly, i.e. discarding the exceptions. (I am not sure
about it right now, but I have a strong suspect. 
Ferenc
Oh, I have missed the TkCore’s after and after_idle methods. Why did I
suck with the understanding of the overcomplicated TkAfter class…?
I will test if this is good to me. Thanks!
Ferenc
Hidetoshi NAGAI wrote:
···
For ‘after idle’ only, there is ‘Tk.after_idle’ method.
It will show an error dialog, when its callback procedure causes an
exception.