data: Still allow project refresh if database file can't be loaded

This commit is contained in:
Eberhard Graether
2018-01-12 19:57:11 +01:00
parent 05ff92fdea
commit 3f60f7a83c
3 changed files with 19 additions and 4 deletions
@@ -964,8 +964,6 @@ void SqliteIndexStorage::setupTables()
LOG_ERROR(std::to_string(e.errorCode()) + ": " + e.errorMessage());
throw(std::exception());
// todo: cancel project creation and destroy created files, display message
}
}
+17 -1
View File
@@ -121,7 +121,17 @@ void Project::load()
canLoad = true;
}
m_storage->setup();
try
{
m_storage->setup();
}
catch(...)
{
LOG_ERROR_STREAM(<< "Exception during storage loading.");
canLoad = false;
m_state = PROJECT_STATE_DB_CORRUPTED;
}
m_sourceGroups = SourceGroupFactory::getInstance()->createSourceGroups(m_settings->getAllSourceGroupSettings());
@@ -197,6 +207,12 @@ void Project::refresh(RefreshMode refreshMode, DialogView* dialogView)
"the project fully reindexed. Do you want to update the project file and reindex the project?";
needsFullRefresh = true;
case PROJECT_STATE_DB_CORRUPTED:
question =
"There was a problem loading the index of this project. The project needs to get fully reindexed. "
"Do you want to reindex the project?";
needsFullRefresh = true;
default:
break;
}
+2 -1
View File
@@ -45,7 +45,8 @@ private:
PROJECT_STATE_OUTDATED,
PROJECT_STATE_OUTVERSIONED,
PROJECT_STATE_SETTINGS_UPDATED,
PROJECT_STATE_NEEDS_MIGRATION
PROJECT_STATE_NEEDS_MIGRATION,
PROJECT_STATE_DB_CORRUPTED
};
Project(const Project&);