Why do good programmers sometimes silently swallow exceptions?

Viewed 19297

I know it's evil, but I've seen swallowed exceptions in code written by a good programmer. So I'm wondering if this bad practice could have at least one positive point.

In other words, it is bad but why do good programmers, on rare occasions, use it?

try
{
    //Some code
}
catch(Exception){}
16 Answers

we use exceptions for runtime errs. because of users and sometimes requirements and such things that occurs when there is a problem. and if we want to show the error to the user we might raise exceptions. eg:-

  1. when the software is running there might be a requirement err and it can be solved by the program itself. so in such cases, the programmer chose to use try statements and there may be a hardware requirement that can't be solved by the software in such cases the programmer chooses the path of raising an exception to alert the user.

and there are many cases that we choose the path of raising an exception or handling exceptions the situation matter.

Related