If there had been a problem with creating the file then the error message should say so. But so far every time there were problems with the database, then the diagnosis had some result.
'check a database, if it has any problems
if theDatabase = nil then Return
dim theDiagnoseFile as FolderItem = folderItemUtils.getTempFolderitem
if theDiagnoseFile = nil or not theDiagnoseFile.Exists then
Globals.theErrorLog.LogItem "It wasn't possible to create the diagnosis file! Please check your permissions and try again."
NotificationManager.Post "DiagnoseFinished", "Failure"
Return
end if
try
if theDatabase.Diagnose(EVVerboseLevel.kVeryHigh, theDiagnoseFile) then
'database is okay
theDiagnoseFile.Delete
NotificationManager.Post "DiagnoseFinished", "Success"
else
if theDiagnoseFile = nil or not theDiagnoseFile.Exists then
Globals.theErrorLog.LogItem "The diagnose file is not there after all."
NotificationManager.Post "DiagnoseFinished", "Failure"
Return
end if
dim theDiagnoseBin as BinaryStream = BinaryStream.Open(theDiagnoseFile, false)
if theDiagnoseBin = nil then
Globals.theErrorLog.LogItem "The diagnose file is there but it can't be read."
NotificationManager.Post "DiagnoseFinished", "Failure"
Return
end if
dim DiagnoseResult as String = theDiagnoseBin.Read(theDiagnoseBin.Length)
Globals.theErrorLog.LogItem "Database Diagnosis Result:", ""
Globals.theErrorLog.LogItem DiagnoseResult, ""
Globals.theErrorLog.LogItem "************************", ""
NotificationManager.Post "DiagnoseFinished", "Failure"
end if
'when the database is really corrupt then there may be a crash instead of a normal diagnose result
catch err as VException
Globals.theErrorLog.LogItem "Database Diagnosis Result:", ""
Globals.theErrorLog.LogItem "Message: " + err.Message + ", Error Number: " + str(err.ErrorNumber) + ", Stack: " + Join(err.stack)
Globals.theErrorLog.LogItem "************************", ""
NotificationManager.Post "DiagnoseFinished", "Failure"
end try
exception exc
theException = new ErrorException(exc, currentMethodName)
Regards
Beatrix Willius