When running LotusScript agents on the web there is no access to a script debugger.
Using the Erl and Error functions within LotusScript you can simply detect the line of your error and display it on the screen.
In a WebQueryOpen agent you cannot "print" to the screen so you can use a field (I have called it called "ErrorField") which is hidden if ErrorField="" On the WebQuerySave or in an ?openagent you can print the error to the Screen.
This also works if the errorhandling is added into functions within the agent as well as the
Initialize.
Sub Initialize On Error Goto ErrorHandler Dim session As New notessession Dim doc as notesdocument Dim db as notesdatabase Set doc=session.documentcontext Set db=session.currentdatabase etc etc etc etc Exit Sub ErrorHandler: Dim ErrString As String ErrString="INITIALIZE : Script Error on Line : " + Cstr(Erl()) + Chr(10)+Chr(10)+"Error Message : " + Error$ Print ErrString 'In WebQueryOpen agent use doc.ErrorField=ErrString Exit Sub End Sub
(When adding the errorhandling into a function replace INITIALIZE with the name of your function to differentiate between failure points)
This was first published in April 2001