Forgotten Notes Features: GetThreadInfo()
When reviewing LotusScript code, every other time I find the following lines of code for errorhandling:
And in each other procedure, the name of the procedure is hardcoded in the errorhandler again. Well, while LotusScript might not have the best error tracing features, it does give you at least some dynamic system information that you can use. In this case, a centralized errorhandling function using GetThreadInfo() would help:
More beautiful options for the parameter are:
And you even don't have to add any %Include directives for the constants. It's easy, it's simple, it's convenient, it helps...
Do you have a good errorhandling routine you use? Place it in the comments and share it with the community.
errHandler:
msgbox "An error occured in procedure 'myProcedure' in line " & erl & ": " & error
(replace "msgbox" by "doLog()" or whatever way of logging you prefer / do).msgbox "An error occured in procedure 'myProcedure' in line " & erl & ": " & error
And in each other procedure, the name of the procedure is hardcoded in the errorhandler again. Well, while LotusScript might not have the best error tracing features, it does give you at least some dynamic system information that you can use. In this case, a centralized errorhandling function using GetThreadInfo() would help:
errHandler:
Call logThis(GetThreadInfo(LSI_THREAD_PROC))
Sub logThis(procedureName as String)
msgbox "An error occured in procedure '" & procedureName & "' in line " & erl & ": " & error
End Sub
Call logThis(GetThreadInfo(LSI_THREAD_PROC))
Sub logThis(procedureName as String)
msgbox "An error occured in procedure '" & procedureName & "' in line " & erl & ": " & error
End Sub
More beautiful options for the parameter are:
- LSI_THREAD_CALLPROC for the name of the calling procedure
- LSI_THREAD_MODULE for the name of the module
- LSI_THREAD_LINE for the current line number
And you even don't have to add any %Include directives for the constants. It's easy, it's simple, it's convenient, it helps...
Do you have a good errorhandling routine you use? Place it in the comments and share it with the community.




Last seen at...
2 Comments:
Thanks for the reminder. This is a good one to use.
Hi Jim,
Thanks for your comment. Yes, I love that command, and it is so easy to use.
Post a Comment
Thank you for your comment. It will be published shortly. Keep having a great day!
<< Home