Run-time exceptions

What’s the best way to handle run-time exceptions that really can’t possibly be the fault of anyone but the developers?

I’m calling Class.newInstance() which throws IllegalAccessException or InstantiationException. However, if it throws either of these, then it’s because of the developer, not something that any module writer or player has done. Right now, there’s only three possible classes that it can be.

This is something that would ideally be checked at compile time, but obviously it can’t. Should I just leave the catch blocks empty, or should I call some error log function?

Thus spake “mkiefte”:

If it’s an unchecked exception, then just let it go all the way to the
exception handler—that will pop up a dialog alerting the user to tell
us about it.

If it’s a checked exception—i.e., one you have to catch somewhere—
you should at least call printStackTrace(), otherwise we have no chance
of ever finding out what’s gone wrong. Additionally, you might want
to call ErrorLog.warn().


Messages mailing list …

Post generated using Mail2Forum (