Tuesday, July 04, 2006

Lsi_info

Most (maybe almost all) Lotus Notes applications will use LotusScript. Even most web application on Lotus Notes, there will be at least some LotusScript involved. One of the key pieces of most LotusScript error handling routines is delivering a message that explains what the error is, and also exactly where it happened. Lsi_info provides some details that is useful in error handling. Lsi_info is mentioned in the LotusScript sections of the Designer Help, as a reserved word, but nowhere does it tell you what it contains.

When you create some methods or functions, typical error handling message would be

something link this

Print "(functionName): Error (" & Cstr(Err) & ") Line: " & Cstr(Erl) & " - " & Error$

Instead of coding the sub or function name, using Lsi_info, you can create a error handling message like below

Print Lsi_info(2) & " called by " & Lsi_info(12) & ": Error (" & Cstr(Err) & ") Line: " & Cstr(Erl) & " - " & Error$

The variable lsi_info is an array of strings.
  • lsi_info(2) is the current module - sub or function name.
  • lsi_info(12) is the module that called this sub or function. If lsi_info(2) is INITIALIZE, then so is lsi_info(12)
You can get a detail article at Dominopower.

2 comments:

Julian Robichaux said...

Another great thing to try for LotusScript error handling is the OpenLog application on the OpenNTF site. It uses lsi_info and many other tricks to easily access error logging information.

All you have to do is copy the script library to your database, include it in your LotusScript code, and type "LogError" in all your error handling blocks.

William Beh said...

@Julian. Yes, OpenLog is a great tool to use. Thanks for the OpenLog contribution to LN community.