summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/storage_common.cpp6
-rw-r--r--common/storage_lmdb.cpp4
2 files changed, 8 insertions, 2 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp
index 3951a81..27139ee 100644
--- a/common/storage_common.cpp
+++ b/common/storage_common.cpp
@@ -40,7 +40,11 @@ static const int s_internalPrefixSize = strlen(s_internalPrefix);
40 40
41void errorHandler(const DataStore::Error &error) 41void errorHandler(const DataStore::Error &error)
42{ 42{
43 SinkWarning() << "Database error in " << error.store << ", code " << error.code << ", message: " << error.message; 43 if (error.code == DataStore::TransactionError) {
44 SinkError() << "Database error in " << error.store << ", code " << error.code << ", message: " << error.message;
45 } else {
46 SinkWarning() << "Database error in " << error.store << ", code " << error.code << ", message: " << error.message;
47 }
44} 48}
45 49
46std::function<void(const DataStore::Error &error)> DataStore::basicErrorHandler() 50std::function<void(const DataStore::Error &error)> DataStore::basicErrorHandler()
diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp
index b389e58..cebd3f0 100644
--- a/common/storage_lmdb.cpp
+++ b/common/storage_lmdb.cpp
@@ -468,8 +468,10 @@ bool DataStore::Transaction::commit(const std::function<void(const DataStore::Er
468 const int rc = mdb_txn_commit(d->transaction); 468 const int rc = mdb_txn_commit(d->transaction);
469 if (rc) { 469 if (rc) {
470 abort(); 470 abort();
471 Error error(d->name.toLatin1(), ErrorCodes::GenericError, "Error during transaction commit: " + QByteArray(mdb_strerror(rc))); 471 Error error(d->name.toLatin1(), ErrorCodes::TransactionError, "Error during transaction commit: " + QByteArray(mdb_strerror(rc)));
472 errorHandler ? errorHandler(error) : d->defaultErrorHandler(error); 472 errorHandler ? errorHandler(error) : d->defaultErrorHandler(error);
473 //If transactions start failing we're in an unrecoverable situation (i.e. out of diskspace). So throw an exception that will terminate the application.
474 throw std::runtime_error("Fatal error while committing transaction.");
473 } 475 }
474 d->transaction = nullptr; 476 d->transaction = nullptr;
475 477