Using checked exceptions forces method callers to deal with errors, either by propagating them or by handling them. Throwing exceptions makes them fully part of the API of the method.


But to keep the complexity for callers reasonable, methods should not throw more than one kind of checked exception.


== Noncompliant Code Example

[source,java]
----
public void delete() throws IOException, SQLException {      // Noncompliant
  /* ... */
}
----


== Compliant Solution

[source,java]
----
public void delete() throws SomeApplicationLevelException {
  /* ... */
}
----


== Exceptions

Overriding methods are not checked by this rule and are allowed to throw several checked exceptions.


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::message.adoc[]

'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
