Throws throwable if it is a RuntimeException or Error. Example usage: for (Foo foo : foos) { try { foo.bar(); } catch (RuntimeException | Error t) { failure = t; } } if (failure != null) { throwIfUnchecked(failure); throw new AssertionError(failure);
(Throwable throwable)
| 130 | |
| 131 | |
| 132 | public static void throwIfUnchecked(Throwable throwable) { |
| 133 | checkNotNull(throwable); |
| 134 | if (throwable instanceof RuntimeException) { |
| 135 | throw (RuntimeException) throwable; |
| 136 | } |
| 137 | if (throwable instanceof Error) { |
| 138 | throw (Error) throwable; |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Propagates {@code throwable} exactly as-is, if and only if it is an instance of |
no test coverage detected