This may be a broad question, but recently I thought about the following: on our C # -component server we have many places that transfer some code to the try/ block catch, in particular, it calls external WcF services. Some of these calls are crucial for the application, so in the catch block we register an error and a reversal, for example:
catch(Exception ex)
{
_logger.Error("Some good error message");
throw ex;
}
On the other hand, there are services that we allow the failure, but we still want to register an error, so they look like this:
catch(Exception ex)
{
_logger.Error("Some good error message");
}
Now, having read the code of the team members, I can’t be sure that they forgot to quit or this is the intended behavior.
Q: Is there a way, resp. which is the default method, DO NOT explicitly revert (without including a comment in the code).
- :
catch(Exception ex)
{
_logger.Error("Some good error message");
NotThrowingHereOnPurpose();
}
private void NotThrowingHereOnPurpose(){}