¿Cómo uso Throwables.propagateIfInstanceOf () de Google Guava?
try {
someMethodThatCouldThrowAnything();
} catch (IKnowWhatToDoWithThisException e) {
handle(e);
} catch (Throwable t) {
Throwables.propagateIfInstanceOf(t, IOException.class);
Throwables.propagateIfInstanceOf(t, SQLException.class);
throw Throwables.propagate(t);
}
no es muy concreto. ¿Cómo se vería un programa real? Realmente no entiendo el propósito de los métodosThrowables.propagateIfInstanceOf(Throwable, Class)
, propagate()
, propagateIfPossible()
. ¿Cuándo los uso?