Ornithology Agent: 10/25/95 02:48:40 PM: Error (4063): Unable to open db CPycha.nsf
Domino エラー定数を使用するには、スクリプトにファイル LSXLERR.LSS がインクルードされていなければなりません。
Sub Initialize
On Error lsERR_NOTES_DATABASE_NOTOPEN Goto logDbOpenError
Dim currentLog As NotesLog
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Set currentLog = New NotesLog( "Ornithology Agent" )
Set db = New NotesDatabase( "", "" )
Call db.OpenMail
Call currentLog.OpenFileLog( "c:¥log.txt" )
Set collection = db.AllDocuments
' error might occur here
Call currentLog.Close
Exit Sub
logDbOpenError:
Call currentLog.LogError _
( lsERR_NOTES_DATABASE_NOTOPEN, _
"Unable to open db " & db.FileName )
Resume Next
End Sub
Sub Initialize
Dim currentLog As NotesLog
Dim session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Set currentLog = New NotesLog( "Geology Agent" )
Call currentLog.OpenNotesLog( "", "agentlog.nsf" )
Set db = session.CurrentDatabase
Set collection = db.FTSearch( "Rocks", 0 )
If ( collection.Count = 0 ) Then
Call currentLog.LogError( 0, "No documents found." )
Else
Set newsletter = New NotesNewsletter( collection )
Set doc = newsletter.FormatMsgWithDoclinks( db )
Call doc.Send( False, "Thalia Ruben" )
End If
Call currentLog.Close
End Sub
10/25/95 04:58:29 PM Let's do division starting
10/25/95 04:58:29 PM Error (11): Division by zero
LotusScript のエラー定数を使用するには、スクリプトにファイル LSERR.LSS がインクルードされていなければなりません。
Sub Initialize
On Error ErrDivisionByZero Goto LogThisError
Dim currentLog As New NotesLog( "Let's do division" )
Dim x As Integer, y As Integer, z As Integer
Call currentLog.OpenMailLog _
( "Joe Perron", "Division log" )
y = 9
z = 0
x = y / z ' error
Call currentLog.Close
Exit Sub
LogThisError:
Call currentLog.LogError( ErrDivisionByZero, _
Error$( ErrDivisionByZero ) )
Resume Next
End Sub
Call currentLog.OpenNotesLog( "", "agentlog.nsf" )
この場合、LogError メソッドは AGENTLOG.NSF に文書を新規作成します。文書には次のアイテムが含まれます。
A$PROGNAME "Let's do division"
A$LOGTIME 10/25/95 04:42:24 PM
A$USER "Kerry Bowling"
A$LOGTYPE "Error"
A$ERRCODE 11
A$ERRMSG "Division by zero"
Call currentLog.OpenFileLog( "c:¥log.txt" )
LogError メソッドは LOG.TXT にテキスト行を新規追加します。LOG.TXT の例を次に示します。
Let's do division: 10/25/95 04:49:51 PM: Error (11): Division by zero