Coding Practice: When should I ignore exceptions?
There is never an acceptable time to catch an exception and ignore it. If you catch an exception, at the very least you should log the exception. If an exception gets thrown frequently, then this is an indication that something is fundamentally wrong with your code and you should fix it at the root.
Quote:
“The worst thing you can do is catch (Exception) and put an empty code block on it. Never do this.”
– Daniel Turini
Application:
You should never have code written in this way:
try { int val = GenericLibrary.ConvertToInt(userInput); return val; } catch (Exception) { //this always throws an exception and I don’t know why }
References:
http://www.codeproject.com/Articles/9538/Exception-Handling-Best-Practices-in-NET