以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  错误捕获问题?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=87749)

--  作者:luodang2050
--  发布时间:2016/7/18 17:04:00
--  错误捕获问题?

如题,怎么捕获发生错误的位置?

以下为错误捕获后输出提示!

\'函数调用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


--  作者:Hyphen
--  发布时间:2016/7/18 18:00:00
--  
什么位置?错误代码的位置?没有办法,只能像上面一样输出错误信息