Some friends have just finished implementing an app and they use custom exceptions to pay attention to me. That when a custom exception was raised, they had logged exceptions to the exception class code, which they had applied. So my question would be a good design approach? My thinking is that logging assistant is more useful
public class BaseCustomException: System.Exception {public BaseCustomException () {TightlyCoupledClass.Log (this); }}
I think by putting them in this place so that they give this assurance It is possible that logging occurs when an exception of CustomException is thrown; However, this is definitely the smelly code.
For exceptions only one exception should be used and the code that executes the code, which can be thrown away by a custom expression, should be able to decide what to do with that exception And whether or not to log on ... because logging should be specific to that scenario, due to which it happened.
On the one hand, note that custom exceptions should be obtained as an application in the form of a root so that you can tell whether the exception is custom from your business libraries or the .NET framework.
- Correction - I just found out that it is not necessary that ApplicationException renders using useless
Comments
Post a Comment