rspec/rules/S2486/java/rule.adoc

49 lines
631 B
Plaintext
Raw Normal View History

2020-06-30 12:48:07 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
public void doTheThing() {
try {
// ...
catch (IOException e) { // Noncompliant
}
}
----
== Compliant Solution
----
public void doTheThing() throws IOException {
// ...
}
----
or
2020-06-30 12:48:07 +02:00
----
public void doTheThing() {
try {
// ...
catch (IOException e) {
LOGGER.info(e);
}
}
----
or
2020-06-30 12:48:07 +02:00
----
public void doTheThing() {
try {
// ...
catch (IOException e) {
// comment explaining why taking no action is appropriate
}
}
----
== Exceptions
When a block contains a comment, it is not considered to be empty.
include::../see.adoc[]