Language: C# | Type: CODE_SMELL | Severity: Minor
Tags: convention
Exceptions types should provide the following constructors:
public MyException()public MyException(string)public MyException(string, Exception)The absence of these constructors can complicate exception handling and limit the information that can be provided when an exception is thrown.
public class MyException : Exception // Noncompliant: several constructors are missing
{
public MyException()
{
}
}
public class MyException : Exception
{
public MyException()
{
}
public MyException(string message)
: base(message)
{
}
public MyException(string message, Exception innerException)
: base(message, innerException)
{
}
}