我必须在错误和实际异常时捕获stacktrace。目前使用以下代码,每次在Call Err.Raise
行显示抛出错误时,它就像行wrapper.getVariable("IRR").value
或wrapper.getVariable("GT_Price").value
On Error Resume Next
wrapper.getVariable("IRR").value = excel.range("'Cases'!$H$753")
wrapper.getVariable("GT_Price").value = excel.range("'Cases'!$H$763")
If Err.Number <> 0 Then
Dim errorMessage, objHTTP, URL, json
errorMessage ="Error while executing EVMLite. Error number " & Err.Number & ". " & Err.Description & " " & Err.Source
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
URL = "http://10.93.24.223:9005/vpp/logerror"
objHTTP.Open "POST", URL, False
objHTTP.SetRequestHeader "Content-Type", "application/json"
json = "{""jobId"": """& jobId &""", ""uniqueId"": """& uniqueId &""", ""errorCode"": """& errorCode &""", ""errorMessage"": """& errorMessage &"""}"
objHTTP.send (json)
On Error Goto 0
Call Err.Raise(vbObjectError + 10, "EVM Failed to execute", errorMessage)
'MsgBox objHTTP.ResponseText
End If