Log fatal LevelDB errors more verbosely

This commit is contained in:
Evan Klitzke 2018-03-09 22:39:04 -08:00
parent 29fad97c32
commit f4b68b3f8f

View file

@ -218,14 +218,10 @@ void HandleError(const leveldb::Status& status)
{ {
if (status.ok()) if (status.ok())
return; return;
LogPrintf("%s\n", status.ToString()); const std::string errmsg = "Fatal LevelDB error: " + status.ToString();
if (status.IsCorruption()) LogPrintf("%s\n", errmsg);
throw dbwrapper_error("Database corrupted"); LogPrintf("You can use -debug=leveldb to get more complete diagnostic messages\n");
if (status.IsIOError()) throw dbwrapper_error(errmsg);
throw dbwrapper_error("Database I/O error");
if (status.IsNotFound())
throw dbwrapper_error("Database entry missing");
throw dbwrapper_error("Unknown database error");
} }
const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w) const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w)