Propagates throwable exactly as-is, if and only if it is an instance of declaredType. Example usage: try { someMethodThatCouldThrowAnything(); } catch (IKnowWhatToDoWithThisException e) { handle(e); } catch (Throwable t) { Throwables.propagateIfInstanceOf(t, IOException.
(@Nullable Throwable throwable, Class<X> declaredType)
| 100 | */ |
| 101 | |
| 102 | @Deprecated |
| 103 | @GwtIncompatible // throwIfInstanceOf |
| 104 | public static <X extends Throwable> void propagateIfInstanceOf(@Nullable Throwable throwable, Class<X> declaredType) |
| 105 | throws X { |
| 106 | if (throwable != null) { |
| 107 | throwIfInstanceOf(throwable, declaredType); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Throws {@code throwable} if it is a {@link RuntimeException} or {@link Error}. Example usage: |
no test coverage detected