|
|
|
|
|
|
|
|
|
|
PROGRAMMING POWER
LSI_Info: obscure but useful information in LotusScript
By Mick Moignard
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. The project I have been working on for the last two or more years has developed an error handling process that uses the NotesLog OpenNotesLog approach to log all errors to an agent log database. This has worked very well for us, except the odd occasion where a too hasty cut/paste has meant that the error message doesn't actually point to where the error occurred.
The code logs errors to an open NotesLog using, in most cases, a line of code that looks like this:
Call NotesLog.LogError(Err,"DoSomeWorkHere " & Error$ & " - Line: " & Cstr(Erl) & doc.universalID
|
"DoSomeWorkHere " is the name of the sub or function containing the code. We also include the UniversalID of any document being processed so that it is easier to track down exactly what the problem is. Every module has this code in it, carried forward from module to module by simple cut/paste operations, and this is where the problem has crept in. You get an error reported from a line of code such as:
The error reported is Object Variable Not Set error, and in the module in question, i is an integer. After several minutes of puzzlement, questioning the parentage of various code-writers including yourself, and then a search in the code for some other sub with the same literal in the logging statement, the light dawns.
The good news is that there is a solution to this. It's the reserved variable called lsi_info. 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. But it contains some useful stuff, as I found out.
About lsi_info The variable lsi_info is an array of strings. I have no idea exactly how big it is, but there are non-zero values in some entries above 200. Here are some immediately useful values:
- 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)
From this, we can see that by changing my error reporting line I can make one that is impervious to cut/paste errors:
Call NotesLog.LogError(Err,lsi_info(2) & " called by " & lsi_info(12) & ": " & Error$ & " - Line: " & Cstr(erl) & doc.universalID
|
There's more. I got curious as to what else there may be in lsi_info, and started some digging. Here's what I've found:
[ Next ]
|
|
|
|
|
|
-- Advertisement --
AUTOMATE LOTUS NOTES USER ID MANAGEMENT
ID Manager 4.5 from HELP Software provides a new level of automaton for managing Lotus Notes IDs. ID Manager lets Lotus Notes administrators get out of the business of creating and managing user IDs. Use our ROI calculator to see how quickly ID Manager will pay for itself.
Learn more about HELP Software products |
-- Advertisement --
INSTALL, UPGRADE NOTES CLIENTS WITHOUT VISITING EACH DESKTOP
Use InstallPump to automate your Notes R8 migration. InstallPump enables you to rollout Notes throughout the enterprise without visiting each desktop.
- 100% fully automated Notes upgrades/installs.
- Modify the Replicator Page, Address Book, and Desktop... and much more.
See for yourself. Full evaluation copy available at installpump.com.
Download your FREE evaluation copy of InstallPump today. |
|
|
|
|
|
|
|
|