try {
someMethodThatCouldThrowAnything();
} catch (IKnowWhatToDoWithThisException e) {
handle(e);
} catch (Throwable t) {
Throwables.propagateIfInstanceOf(t, IOException.class);
Throwables.propagateIfInstanceOf(t, SQLException.class);
throw Throwables.propagate(t);
}
Run Code Online (Sandbox Code Playgroud)
不是很具体.真正的程序会是什么样子?我真的不明白的方法的目的Throwables.propagateIfInstanceOf(Throwable, Class),propagate(),propagateIfPossible().我什么时候使用它们?