Files
openide/java/java-impl/resources/inspectionDescriptions/ExceptionFromCatchWhichDoesntWrap.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

24 lines
1.1 KiB
HTML

<html>
<body>
Reports exceptions that are thrown from inside <code>catch</code> blocks but do not "wrap" the caught exception.
<p>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.</p>
<p><b>Example:</b></p>
<pre><code>
...
catch (IOException e) {
closeAllConnections();
throw new ConnectException("Connection problem."); // warning: 'throw' inside 'catch' block ignores the caught exception 'e'
}
</code></pre>
<!-- tooltip end -->
<p>Configure the inspection:</p>
<ul>
<li>Use the <b>Ignore if result of exception method call is used</b> option to indicate whether the inspection should ignore exceptions whose
argument is the result of a method
call on the original exception, such as <code>getMessage()</code>.</li>
<li>Use the <b>Ignore if thrown exception cannot wrap an exception</b> option to ignore <code>throw</code> statements that throw exceptions without a
constructor that accepts a <code>Throwable</code> cause.</li>
</ul>
</body>
</html>