Try catch finally blocks.. do i still need them?
- by Phil
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.