aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-03-13 12:16:26 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-03-13 12:16:32 -0400
commit3d16f581538b0974853e820508e8b3093269d2fd (patch)
tree2869bf44e352cf1a519b590cd6dae4133c05de2a /src
parentae5bcc7abb14d6ba87399bcc941e8ea5524e4e08 (diff)
parentf4b68b3f8f6bb8ad45a9c13c70be0e24404ecd54 (diff)
Merge #12659: Improve Fatal LevelDB Log Messages
f4b68b3f8f Log fatal LevelDB errors more verbosely (Evan Klitzke) Pull request description: The `leveldb::Status` class logs the filename of corrupted files, which might be useful when looking at error reports from usres. In theory this is already logged via the `LogPrintf()` statement in `HandleError()`, but that may not always be close to where the final error message is logged, e.g. see https://github.com/bitcoin/bitcoin/issues/11355#issuecomment-340340542 where the log trace provided by the user does not contain that information (and other user comments in the same issue). This also adds a log message instructing the user to run the process with `-debug=leveldb`, which provides much more verbose error messages about LevelDB internals. This may not really help much, but improving the error messages here can't hurt. Tree-SHA512: bbdc52f0ae50e77e4d74060f9f77c6a0b10d5fad1da371eec1ad38a499af5fde3a3b34dd915e721f6bbe779a1f9693ab04fd9cdbcfa95c28f2979b4c0df181c9
Diffstat (limited to 'src')
-rw-r--r--src/dbwrapper.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp
index 6cac625abc..fb0d4215a2 100644
--- a/src/dbwrapper.cpp
+++ b/src/dbwrapper.cpp
@@ -218,14 +218,10 @@ void HandleError(const leveldb::Status& status)
{
if (status.ok())
return;
- LogPrintf("%s\n", status.ToString());
- if (status.IsCorruption())
- throw dbwrapper_error("Database corrupted");
- if (status.IsIOError())
- throw dbwrapper_error("Database I/O error");
- if (status.IsNotFound())
- throw dbwrapper_error("Database entry missing");
- throw dbwrapper_error("Unknown database error");
+ const std::string errmsg = "Fatal LevelDB error: " + status.ToString();
+ LogPrintf("%s\n", errmsg);
+ LogPrintf("You can use -debug=leveldb to get more complete diagnostic messages\n");
+ throw dbwrapper_error(errmsg);
}
const std::vector<unsigned char>& GetObfuscateKey(const CDBWrapper &w)