All,

My humble opinion is that EACH is a very strong word.  I think the whole
point behind TRY/CATCH which I use more sparingly, is if there is a
chance that there might be some exception that can be caused that will
throw an error, catch it and error out in a classy way. It would be a
serious waste to time to do it in each method/function. 
 
If your function took a few numbers and added them to each other, and
the original numbers were in the correct datatype why would you need to
try/catch them
 
------------------------------------------------------------------------
-------------------------------
Private Function calculateTotal (by val subtotal as decimal, newproduct
as decimal, tax as decimal) as decimal
Dim FinalTotalToPay as decimal
 
Try
            FinalTotalToPay = subtotal + newproduct + tax
            Return FinalTotal
Catch
            MsgBox("An Error Has Ocurred, please check your values")
            Return 0
End Function
 
Versus
 
Private Function calculateTotal (by val subtotal as decimal, newproduct
as decimal, tax as decimal) as decimal
Dim FinalTotalToPay as decimal
 
Try
            FinalTotalToPay = subtotal + newproduct + tax
            Return FinalTotal
Catch
            MsgBox("An Error Has Ocurred, please check your values")
            Return 0
End Function
 
 
You would never really catch any exceptions, right???
 
Thanks,
 
Ali
 
 
 
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of P P
Sent: Saturday, May 14, 2005 3:07 PM
To: [email protected]
Subject: [AspNetAnyQuestionIsOk] Using Exception in ASP.NET
 
Hi All

I have a question with regards to using Try/Catch
block within my code, and this question arose after a
argument with my colleues:-)

I personally believe it's safe and good practice to
use try/catch block within each Method/Function, per
them it is not really required (nobody amongst us had
real justification for why / why not required)

Anybody has any other sugestions or comments?

Thanks
PP


            
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html



  _____  

Yahoo! Groups Links
*         To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
  
*         To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
cribe> 
  
*         Your use of Yahoo! Groups is subject to the Yahoo! Terms of
<http://docs.yahoo.com/info/terms/>  Service. 


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to