Skip to content

Instantly share code, notes, and snippets.

@dadepo
Last active August 29, 2015 14:07
// Source https://dev.eclipse.org/sonar/rules/show/squid:S00112
// Using such generic exception prevents calling methods from
// handling differently each kind of error.
// The following code snippet illustrates this rule:
public void foo(String bar) throws Throwable { // Non-Compliant
throw new RuntimeException("My Message"); // Non-Compliant
}
public void foo(String bar) {
throw new MyRuntimeException("My Message"); // Compliant
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment