如题,怎么捕获发生错误的位置?
以下为错误捕获后输出提示!
'函数调用0========================
'Functions.Execute("捕获错误输出",ex,[s])
'ex:错误的对象
's:自定义错误提醒
'函数调用1========================
Dim ex As system.SystemException = args(0)
Dim s As String
s &= "Message:" & ex.Message
s &= _hl & "Source:" & ex.Source
s &= _hl & "HelpLink:" & ex.HelpLink
's &= _hl & "Data:" & ex.Data
If ex.Data.Count > 0 Then
Dim tmp As String
For Each de As System.Collections.DictionaryEntry In ex.Data
tmp &= de. Key.ToString() & "'" & de.Value
Next
MessageBox.Show("ex.data:" & _hl & tmp)
End If
If ex.InnerException IsNot Nothing Then
s &= _hl & "InnerException:" & ex.InnerException.ToString( )
End If
s &= _hl & "TargetSite:" & ex.TargetSite.ToString( )
s &= _hl & "StackTrace:" & ex.StackTrace
If args.length > 1
s = args(1) & _hl & s
End If
MessageBox.Show(s)
Return 0