C
csharper
I've learned quite a few best practice rules for exception handling
from
http://www.codeproject.com/KB/architecture/exceptionbestpractices.aspx
My question here isn't addressed in that article. I know that
catching a generic Exception is not recommended. But what about
catching nothing like so?
try
{
// code that may throw exceptions
}
catch // since catch(Exception ex) is not recommended, right?
{
myLogger.Debug("Some error has occurred.");
}
I ask because
1) I really don't know what exception maybe thrown from the existing
code snippet,
2) Yet, I do need to log the error if it does happen.
What would you do?
from
http://www.codeproject.com/KB/architecture/exceptionbestpractices.aspx
My question here isn't addressed in that article. I know that
catching a generic Exception is not recommended. But what about
catching nothing like so?
try
{
// code that may throw exceptions
}
catch // since catch(Exception ex) is not recommended, right?
{
myLogger.Debug("Some error has occurred.");
}
I ask because
1) I really don't know what exception maybe thrown from the existing
code snippet,
2) Yet, I do need to log the error if it does happen.
What would you do?