catch
blocks but do not "wrap" the caught exception.
When an exception is thrown in response to an exception, wrapping the initial exception prevents losing valuable context information, such as stack frames and line numbers.
Example:
...
catch (IOException e) {
closeAllConnections();
throw new ConnectException("Connection problem."); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'
}
Configure the inspection:
getMessage()
.throw
statements that throw exceptions without a
constructor that accepts a Throwable
cause.