I’ve been using Java for more years than I care to mention but I never realized that you could catch errors as well as exceptions.i

So I’ve just added one more item to my toolbox. My main() method always uses this template:

try {
  // do something.
} catch (Error e) {
} catch (Exception e) {
} finally {

Of course, in my real code I use log4j so that the errors are persisted.