|
|
|
|
|
|
|
|
|
|
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 --
Learn Notes and Domino 8 at your place and pace!
Learn Notes and Domino in your office and/or home! TLCC's highly acclaimed distance learning courses for users, developers, and admins will enhance your career and your resume.
The many included activities and demos will make you a pro! Expert instructor help is a click away.
Click here to try a FREE demo course!!
|
-- Advertisement --
Webinar: Agents Gone Wild! with Rocky Oliver & John Kingsley
We can all appreciate what agents can do for us when they're on our team, but how do you identify agents that aren't doing what they're supposed to be doing?
In this webinar we'll discuss tips to help you manage your agents more effectively, including ways to identify all of your agents, to give them the makeover they need, locate agents with errors at run time, and more.
View this webinar!
|
|
|
|
|
|
|
|
|