Hi,
I end up utilizing exemption in web improvement notwithstanding for conditions that are not by any stretch of the imagination mistakes, not to mention uncommon ones - just rationale choices, approvals...
in a website page, I frequently compose code like so:
- try
- {
- int id;
- if(!int.TryParse(txtID.Text, out id))
- throw new Exception("ID must be an integer");
- if(IdAlreadyExists(id))
- throw new Exception("ID already exists in database");
- //and so on...
- }
- catch(Exception ex)
- {
- SetErrorLine(ex.Message);
- }
I was thinking about whether this is extremely the right method for utilizing special cases and authorizing Business Logic in web advancement.
P.S.: I am utilizing asp.net, and clearly I could utilize ASP.NET validators for some of these and furthermore isolate UI from rationale, yet I'm endeavoring to make a point of the general thought.
Thanks and Regards
sireesha.
Rupesh KahanePosted Jan 24, 2018, 1:26 PM