LOTUSSCRIPT /COM/OLE のクラス
Lotus 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
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
この場合、LogError メソッドは AGENTLOG.NSF に文書を新規作成します。文書には次のアイテムが含まれます。
A$PROGNAME"Let's do division" A$LOGTIME10/25/95 04:42:24 PM A$USER"Kerry Bowling" A$LOGTYPE"Error" A$ERRCODE11 A$ERRMSG"Division by zero"
LogError メソッドは LOG.TXT にテキスト行を新規追加します。LOG.TXT の例を次に示します。
Let's do division:10/25/95 04:49:51 PM:Error (11):Division by zero