Improve error message.

This commit is contained in:
levlam 2021-11-14 10:07:04 +03:00
parent ed56a75b8a
commit 43855f0ce4

View File

@ -73,10 +73,10 @@ SqliteDb::~SqliteDb() = default;
Status SqliteDb::init(CSlice path, bool allow_creation) { Status SqliteDb::init(CSlice path, bool allow_creation) {
// if database does not exist, delete all other files which could have been left from the old database // if database does not exist, delete all other files which could have been left from the old database
bool is_db_exists = stat(path).is_ok(); auto database_stat = stat(path);
if (!is_db_exists) { if (database_stat.is_error()) {
if (!allow_creation) { if (!allow_creation) {
LOG(FATAL) << "Database was deleted during execution and can't be recreated"; LOG(FATAL) << "Database was deleted during execution and can't be recreated: " << database_stat.error();
} }
TRY_STATUS(destroy(path)); TRY_STATUS(destroy(path));
} }