Guest User

Untitled

a guest
Jul 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. protected <E extends Throwable> void throwIf(Throwable e, Class<E> c) throws E {
  2. if (e.getCause() != null && c.isInstance(e)) {
  3. throw (E) e.getCause();
  4. } else if (e instanceof RuntimeException) {
  5. throw (RuntimeException) e;
  6. } else {
  7. throw new IllegalStateException("Unexpected exception (Yo Dawg!): " + e.getMessage(), e);
  8. }
  9. }
Add Comment
Please, Sign In to add comment