In the past I\'d read tons of code with methods like:
public Object doSomething() throws Throwable {
...
}
Is it common practice to do
Functionally, it is equivalent with throws Exception
, since errors are unchecked.
I see no reason to declare a method to throw Throwable. However, this doesn't mean that catch and printStackTrace is a good alternative.
Usually, you want to catch throwables where you can do something sensible with them.
Code that throws a throwable you don't expect should explode gloriously, so you can see the error and fix the bug.