Skip to content

Instantly share code, notes, and snippets.

@jarrodhroberson
Last active August 29, 2015 14:07
Show Gist options
  • Save jarrodhroberson/068568bf7ef02eb045d5 to your computer and use it in GitHub Desktop.
Save jarrodhroberson/068568bf7ef02eb045d5 to your computer and use it in GitHub Desktop.
How to document possible exceptions but not weigh now clients code with mandatory try/catch noise!
public class DocumentedRuntimeExceptionExample
{
public static void main(final String[] args)
{
test();
}
public static void test() throws TestFailedRuntimeException
{
// do some stuff that may or may not throw an exception
}
public static class TestFailedRuntimeException extends RuntimeException
{
// this is just a strawman example!
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment