I don't know if this idea is possible to implement. If not, i would appreciate some alternative.
I need to create an custom exception class that can catch any time of error, as do the System.Exception class. But on catching an exception, it would be able to log the error.
This code is my implementation, but it does not catch any type of exceptions.
public class CustomException : Exception
{
public CustomException()
{
//Log error
}
public CustomException(string message)
: base(message)
{
//Log error
}
public CustomException(string message, Exception inner)
: base(message, inner)
{
//Log error
}
}
Thanks in advance.