Manage Learn to apply best practices and optimize your operations.

Coding a stack trace into LotusScript libraries eases error handling

You may be familiar with Java's stack trace information. Did you know you can also code a stack trace into your LotusScript libraries and agents? Use this quick code in your Lotus Notes environment.

Once I became familiar with Java's stack trace information, I found that receiving the Lotus Notes error message: "Object Variable Not Set" no longer helped me properly trap and manage errors.

Related resources from
LotusScript agent indexes Lotus Notes/Domino databases

LotusScript code pluralizes singular nouns automatically 

LotusScript button saves time searching large Lotus Notes databases

I've found a way to code a stack trace into LotusScript libraries and agents. The trick is that you must have an error trap in every sub, function or method to capture useful information. Then, the code will build the stack as each error trap is tripped.

Following is output from my example:

Error: method ExampleClass.setup() 
has not been implemented.
 at [Exampleclass.New( ): 11]
 at [getObject('abstract').Getexampleobject: 8]  
 at [ExampleAgent.Initialize( ): 13]

LotusScript to retrieve stack trace
(Click on code for enlarged view and script download.)

Do you have comments on this tip? Let us know.

This tip was submitted to the tip library by member Rodney Rear. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes/Domino technical tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...