您的位置:首页 > 其它

Error Err, ">" & Getthreadinfo(LSI_THREAD_PROC) & " (" & Cstr(Erl) & ") " & Error

2011-06-14 15:38 453 查看
此用法很有用,有待研究

通过GetThreadInfo()获得的LSI_INFO,提供了LS的Runtime信息。

CodeMeaning
LSI_THREAD_LINECurrent Line Number
LSI_THREAD_PROCName of current procedure
LSI_THREAD_MODULEName of current module
LSI_THREAD_VERSIONLotusScript version number
LSI_THREAD_LANGUAGE(Human) language setting
LSI_THREAD_COUNTRYCountry or region setting
LSI_THREAD_TICKSGet current clock ticks
LSI_THREAD_TICKS_PER_SECGet clock ticks per second (supported only on platforms that support parallel processing primitives)
LSI_THREAD_PROCESS_IDGet current process ID (supported only on platforms that support parallel processing primitives)
LSI_THREAD_TASK_IDGet current task ID (supported only on platforms that support parallel processing primitives)
LSI_THREAD_CALLPROCGet the name of the calling procedure
LSI_THREAD_CALLMODULEGet the name of the calling module
GetThreadInfo(11) 返回了调用的class

GetThreadInfo(10) 返回了调用的function

我们可以自己构造一个函数RaiseError() ,用于其他程序的调用。

Function RaiseError()
Dim thisType As String
Dim es as String
thisType = Typename(Me)
' Not a class, use the calling module instead
If (thisType = "") Then thisType = Getthreadinfo(11)
es = thisType & "::" & Getthreadinfo(10) & ": "
If (Err = 0) Then
es = es + "Manually raised an error"
Else
es = es + "Run time error: (" + Trim(Str(Err)) + ") " + _
Error$ + " at line: "+ Trim(Str(Erl))
End If
Print es
end function
我们在调用时可以按以下方式使用:

' calling code...
...
ExitFunction:
exit function
errorhandler:
Call RaiseError()
resume exitFunction
end function
Msgbox Getthreadinfo(LSI_THREAD_MODULE) 在客户端显示 单元的 十六进制,在web下调用会显示脚本名称(在代理中无效)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐