Lotus Notes FAQ Visit Our Sponsor!

How do you prevent LotusScript errors when handling deletion stubs in document collections?

Sometimes when you get a document collection for a LotusScript agent to handle, Notes passes you a deletion stub (this is probably a bug). In case you have to handle it, you can use this code:

' From Mike Woolsey
' IsErr_NOTES_ERROR is 4000
On Error lsErr_NOTES_ERROR Goto HandleDocError
dim failureCode as Integer    ' may be global
dim test as Variant
set doc = dc.GetFirstDocument    ' say this is a FTS result collection, the doc may have been deleted since it was indexed
while not(doc is Nothing)
  failureCode% = 0
  test = doc.Items
  if failureCode% = 0 then   ' no error
    ....   ' handle document
  end if
  set doc = dc.GetNextDocument(doc)

  failureCode% = Err
  Resume next

Applies to Notes Versions: 4 4.5 4.6 5
Last Modified: April 2, 1998