I have a ASP.NET project and in some part of it I call a business rule to test the form:
[HttpPost]
public ActionResult InsertProduct(Product Product)
{
try
{
InsertProductBLL ProductInsertion = new InsertProductBLL (Product.Value, Product.Description);
ProductInsertion.IsValid();
return PartialView("Success");
}
catch (Exception e)
{
Console.Write(e.Message);
return PartialView("Fail");
}
}
On the BLL, I have this:
public void IsValid()
{
if (Value> 10) ; //I just want the else section
else
{
Exception e = new Exception("Insert a bigger value");
throw e;
}
}
However, the console only prints that the exception has been thrown, but not the message that I asked for. Is there any syntax mistake or something that I just messed up?