aboutsummaryrefslogtreecommitdiff
path: root/src/leveldb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/leveldb.cpp')
-rw-r--r--src/leveldb.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/leveldb.cpp b/src/leveldb.cpp
index e66f8514a7..fb202367c4 100644
--- a/src/leveldb.cpp
+++ b/src/leveldb.cpp
@@ -15,6 +15,7 @@
void HandleError(const leveldb::Status &status) throw(leveldb_error) {
if (status.ok())
return;
+ LogPrintf("%s\n", status.ToString().c_str());
if (status.IsCorruption())
throw leveldb_error("Database corrupted");
if (status.IsIOError())
@@ -47,16 +48,15 @@ CLevelDB::CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool
options.env = penv;
} else {
if (fWipe) {
- printf("Wiping LevelDB in %s\n", path.string().c_str());
+ LogPrintf("Wiping LevelDB in %s\n", path.string().c_str());
leveldb::DestroyDB(path.string(), options);
}
boost::filesystem::create_directory(path);
- printf("Opening LevelDB in %s\n", path.string().c_str());
+ LogPrintf("Opening LevelDB in %s\n", path.string().c_str());
}
leveldb::Status status = leveldb::DB::Open(options, path.string(), &pdb);
- if (!status.ok())
- throw std::runtime_error(strprintf("CLevelDB(): error opening database environment %s", status.ToString().c_str()));
- printf("Opened LevelDB successfully\n");
+ HandleError(status);
+ LogPrintf("Opened LevelDB successfully\n");
}
CLevelDB::~CLevelDB() {
@@ -72,10 +72,6 @@ CLevelDB::~CLevelDB() {
bool CLevelDB::WriteBatch(CLevelDBBatch &batch, bool fSync) throw(leveldb_error) {
leveldb::Status status = pdb->Write(fSync ? syncoptions : writeoptions, &batch.batch);
- if (!status.ok()) {
- printf("LevelDB write failure: %s\n", status.ToString().c_str());
- HandleError(status);
- return false;
- }
+ HandleError(status);
return true;
}