https://software.codidact.com/categories/38/tags/4855.rssNew Posts Tagged 'exception' - Software DevelopmentSoftware Development - Codidact2024-02-02T07:27:20Zhttps://software.codidact.com/posts/287312How can I provide additional information when raising an exception?mcphttps://software.codidact.com/users/568022022-10-25T15:30:33Z2024-02-02T07:27:20Z<p>Suppose I have some code like:</p>
<pre><code class="language-py">filename = "bad_dir"
print(f"File not found: {filename}.")
raise(FileNotFoundError)
</code></pre>
<p>When the exception i...https://software.codidact.com/posts/286444Measuring the impact of using exceptions instead of return values in an ASP.NET Core applicationAlexeihttps://software.codidact.com/users/531772022-05-14T08:30:15Z2022-05-14T21:38:05Z<h2>Context</h2>
<p><a href="https://stackoverflow.com/questions/891217/how-expensive-are-exceptions-in-c">This Q&A from SO</a> suggests that throwing exceptions is incredibly expensive when c...https://software.codidact.com/posts/286047How to avoid "exception is never thrown" when commenting out a line while debuggingklutthttps://software.codidact.com/users/81962022-03-02T09:06:46Z2022-03-20T17:07:30Z<p>I have a code block like this:</p>
<pre><code>try {
...
x.foo(); // This is the line that forces us to have the try block
...
} catch (ArrayIndexOutOfBoundsException e) {
l...https://software.codidact.com/posts/281015Multiple catches with almost the same code.Estelahttps://software.codidact.com/users/533202021-03-09T09:21:59Z2021-03-12T06:53:16Z<p>I find myself often writing code like this.</p>
<pre><code class="language-C++">try {
// code
}
catch( FailedReadException const & ex) {
file.close();
std::cerr << "Re...