Don't say anyway, say anyhow

you are viewing a single comment's thread
view the rest of the comments
[–] 12 points 1 year ago (3 children)
try
{
     execute.SomeMethod();
}
catch(Exception ex)
{}
  • source
  • hideshow 3 child comments
  • [–] 1 point 1 year ago (1 child)

    I've seen this in production code before. I might argue if you caught a very specific exception type that didn't matter it might be acceptable. Maybe. But just the overall Exception type... Recipe for disaster.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 1 year ago*

    What really sucks, imho, is that lazy programmers won in java's checked exception wars.

    With checked exceptions you have to type a little more, but it means that you can be sure you caught every exception type.

    By making everything into a runtime exception you never know if you caught all relevant types of exceptions.

    Which then again leads to people blanket-catching Exception because that way the app will at least not randomly crash due to a forgotten catch for some obscure exception type.

    It's a trash solution for a trash problem caused by lazyness even though there was a real solution available all along.

  • source
  • parent