【发布时间】:2011-02-26 18:39:52
【问题描述】:
我在这个方法中通过我的 global.asax 处理错误:
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()
在我的代码中,我目前没有其他错误处理。我还应该插入 try、catch、finally 块吗?
谢谢。
【问题讨论】:
标签: vb.net exception exception-handling try-catch