sireesha siri

sireesha siri

  • NA
  • 9
  • 2.4k

special case of use in web improvement?

Jan 23 2018 8:25 AM
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:
 
  1. try  
  2.    
  3. {  
  4.    
  5. int id;  
  6.    
  7. if(!int.TryParse(txtID.Text, out id))  
  8.    
  9. throw new Exception("ID must be an integer");  
  10.    
  11. if(IdAlreadyExists(id))  
  12.    
  13. throw new Exception("ID already exists in database");  
  14.    
  15. //and so on...  
  16.    
  17. }  
  18.    
  19. catch(Exception ex)  
  20. {  
  21. SetErrorLine(ex.Message);  
  22. }  
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. 
 

Answers (1)