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

来源:互联网 发布:中国资本主义知乎 编辑:程序博客网 时间:2024/06/08 08:54

 

 

此用法很有用,有待研究

 

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

CodeMeaningLSI_THREAD_LINECurrent Line Number LSI_THREAD_PROCName of current procedureLSI_THREAD_MODULEName of current moduleLSI_THREAD_VERSIONLotusScript version numberLSI_THREAD_LANGUAGE(Human) language settingLSI_THREAD_COUNTRYCountry or region settingLSI_THREAD_TICKSGet current clock ticksLSI_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 procedureLSI_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下调用会显示脚本名称(在代理中无效)

 

 

原创粉丝点击