If the program has an event loop (which is likely if it has a GUI),
then [bgerror] is the way to intercept uncaught errors in event
handlers. If the pop-up is the default one provided by Tk, then
defining bgerror will take over, and your code is then in charge
(using ::errorInfo, ::errorCode, and [info errorstack] in 8.6).
If this pop-up is already made by some other programmer's [bgerror],
then you may want to [rename] it out instead of overwriting it, so
that you can delegate to it after adding your part.
-Alex