Bug 385262 - NOTREACHED called before logging. Patch by Ryan Jones <sciguyryan@gmail.com>. r=sdwilsh

This commit is contained in:
sdwilsh%shawnwilsher.com 2007-06-21 23:52:18 +00:00
Родитель 0ce6e8791b
Коммит 681dd890b2
1 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -1530,8 +1530,18 @@ ProcessAsyncMessages()
// check for error
if (rc != SQLITE_OK) {
AsyncWriteError = rc;
NS_NOTREACHED("FILE ERROR");
nsAutoString logMessage;
logMessage.AssignLiteral("mozStorage: error code ");
logMessage.AppendInt(rc);
logMessage.AppendLiteral(" for database ");
if (message->mFile && message->mFile->mFilename)
logMessage.Append(NS_ConvertUTF8toUTF16(*message->mFile->mFilename));
#ifdef DEBUG
printf("%s\n", NS_ConvertUTF16toUTF8(logMessage).get());
#endif
// log error to console
nsresult rv;
nsCOMPtr<nsIConsoleService> consoleSvc =
@ -1539,16 +1549,12 @@ ProcessAsyncMessages()
if (NS_FAILED(rv)) {
NS_WARNING("Couldn't get the console service for logging file error");
} else {
nsAutoString logMessage;
logMessage.AssignLiteral("mozStorage: error code ");
logMessage.AppendInt(rc);
logMessage.AppendLiteral(" for database ");
if (message->mFile && message->mFile->mFilename)
logMessage.Append(NS_ConvertUTF8toUTF16(*message->mFile->mFilename));
rv = consoleSvc->LogStringMessage(logMessage.get());
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Couldn't log message on async error");
}
NS_NOTREACHED("FILE ERROR");
// tell user to restart
DisplayAsyncWriteError();
return;