Try catch finally blocks.. do i still need them?

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-06-02T11:13:29Z Indexed on 2010/06/02 11:13 UTC
Read the original article Hit count: 290

I am handling errors via my global.asax in this method:

Dim CurrentException As Exception
CurrentException = Server.GetLastError()
Dim LogFilePath As String = Server.MapPath("~/Error/" & DateTime.Now.ToString("dd-MM-yy.HH.mm") & ".txt")
Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter(LogFilePath)
sw.WriteLine(DateTime.Now.ToString)
sw.WriteLine(CurrentException.ToString())
sw.Close()

In my code I currently have no other error handling. Should I still insert try, catch, finally blocks?

Thanks.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about exception