Skip to content

Instantly share code, notes, and snippets.

@adamv
Created April 10, 2017 23:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamv/cb9eee14dea592dee1d62f48c92edc13 to your computer and use it in GitHub Desktop.
Save adamv/cb9eee14dea592dee1d62f48c92edc13 to your computer and use it in GitHub Desktop.
class Stuff {
void method() {
/*.. in a catch block ..*/
throw translate(ex);
}
@SuppressWarnings("UnusedReturnValue")
private static RuntimeException translate(Exception ex)
throws SomeCheckedException, SomeOtherException {
if (ex instanceof SomeException) {
throw new SomeCheckedException(ex);
} else {
throw new SomeOtherException(ex);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment