You can throw any custom exception like this way.
public DiscontinuedProductException discontinuedProductException1 = new DiscontinuedProductException();
[SerializableAttribute()]
public class DiscontinuedProductException : Exception
{
public DiscontinuedProductException()
: base()
{
}
public DiscontinuedProductException(string message)
: base(message)
{
}
public DiscontinuedProductException(string message, Exception innerException)
: base(message, innerException)
{
}
protected DiscontinuedProductException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}