KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
When validating data, I've gotten into a habit of doing the following: Note: I don't 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("Failed 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?
Tags (comma-separated)
Save Edits
Cancel