Hi,
When validating data, I've gotten into a habit of doing the following
*Note: i dont really have individual booleans for each check. This is just for the example.
*Another Note: any error handling during the tests are done properly. The ONLY exceptions thrown in the try-catch are my own.
Try
{
if(validCheckOne = false)
{ throw new Exception("Check one is bad"); }
if(validCheckTwo = false)
{ throw new Exception("Fail'D because of check2"); }
if(validCheckTen = false)
{ throw new Exception("Yet another failure on your part: check10."); }
}
catch(Exception e)
{
MessageBox.Show("Your stupid data is wrong! See for yourself: " + e.Message);
}
Is this bad practice? Does throwing Exceptions slow the program's execution or is inadvisable?