I am mostly writing a small tools for tech savvy people, e.g. programmers, engineers etc. As those tools are usually quick hacks improved over time I know that there are going to be unhandled exceptions and the users are not going to mind. I would like the user to be able to send me the traceback so I can examine what happened and possibly improve the application.
I usually do wxPython programming but I have done some Java recently. I have hooked up the TaskDialog class to the Thread.UncaughtExceptionHandler() and I am quite happy with the result. Especially that it can catch and handle exceptions from any thread:


I was doing something similar in wxPython for a long time. However:
- I had to write a decorator-hack to be able to print exceptions from another thread well.
- Even when functional, the result is quite ugly.

Here is the code for both Java and wxPython so you can see what I have done:
Java:
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.JButton;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import com.ezware.dialog.task.TaskDialogs;
public class SwingExceptionTest {
private JFrame frame;
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}
catch (ClassNotFoundException e) {
}
catch (InstantiationException e) {