Improve error logging in walletdb.cpp
This commit is contained in:
parent
d4b2ec6359
commit
66756d1a13
|
@ -936,7 +936,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
|||
Dbc* pcursor = GetCursor();
|
||||
if (!pcursor)
|
||||
{
|
||||
LogPrintf("Error getting wallet database cursor\n");
|
||||
LogPrintf("LoadWallet: Error getting wallet database cursor.");
|
||||
return DB_CORRUPT;
|
||||
}
|
||||
|
||||
|
@ -950,7 +950,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
|||
break;
|
||||
else if (ret != 0)
|
||||
{
|
||||
LogPrintf("Error reading next record from wallet database\n");
|
||||
LogPrintf("LoadWallet: Error reading next record from wallet database.");
|
||||
return DB_CORRUPT;
|
||||
}
|
||||
|
||||
|
@ -963,6 +963,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
|||
result = DB_WRONG_NETWORK;
|
||||
} else if (result != DB_WRONG_NETWORK && IsKeyType(strType)) {
|
||||
// losing keys is considered a catastrophic error
|
||||
LogPrintf("LoadWallet: Unable to read key/value for key type %s (%d)", strType, result);
|
||||
result = DB_CORRUPT;
|
||||
} else {
|
||||
// Leave other errors alone, if we try to fix them we might make things worse.
|
||||
|
@ -974,7 +975,7 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
|||
}
|
||||
}
|
||||
if (!strErr.empty())
|
||||
LogPrintf("%s\n", strErr);
|
||||
LogPrintf("LoadWallet: %s", strErr);
|
||||
}
|
||||
pcursor->close();
|
||||
|
||||
|
@ -983,15 +984,22 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
|
|||
// We can be more permissive of certain kinds of failures during
|
||||
// loading; for now we'll interpret failure to reconstruct the
|
||||
// caches to be "as bad" as losing keys.
|
||||
LogPrintf("LoadWallet: Failed to restore cached wallet data from chain state.");
|
||||
result = DB_CORRUPT;
|
||||
}
|
||||
}
|
||||
catch (const boost::thread_interrupted&) {
|
||||
throw;
|
||||
}
|
||||
catch (...) {
|
||||
catch (const std::exception& e) {
|
||||
LogPrintf("LoadWallet: Caught exception: %s", e.what());
|
||||
result = DB_CORRUPT;
|
||||
}
|
||||
catch (...) {
|
||||
LogPrintf("LoadWallet: Caught something that wasn't a std::exception.");
|
||||
result = DB_CORRUPT;
|
||||
}
|
||||
|
||||
|
||||
if (fNoncriticalErrors && result == DB_LOAD_OK)
|
||||
result = DB_NONCRITICAL_ERROR;
|
||||
|
|
Loading…
Reference in New Issue