Make initialization fail with a specific exception if the dataset isn't compatible with the algorithm being used, rather than crashing when a query occurs.

This commit is contained in:
Daniel Patterson
2017-06-05 15:58:50 -07:00
committed by Patrick Niklaus
parent 3d77714c36
commit 5026741652
10 changed files with 138 additions and 47 deletions
+5 -21
View File
@@ -223,33 +223,17 @@ int main(int argc, const char *argv[]) try
{
config.storage_config = storage::StorageConfig(base_path);
}
if (!config.use_shared_memory && !config.storage_config.IsValid())
{
util::Log(logERROR) << "Required files are missing, cannot continue";
return EXIT_FAILURE;
}
if (!config.IsValid())
{
if (base_path.empty() != config.use_shared_memory)
{
util::Log(logWARNING) << "Path settings and shared memory conflicts.";
}
else
{
auto required_files = {config.storage_config.ram_index_path,
config.storage_config.file_index_path,
config.storage_config.hsgr_data_path,
config.storage_config.node_based_nodes_data_path,
config.storage_config.edge_based_nodes_data_path,
config.storage_config.edges_data_path,
config.storage_config.core_data_path,
config.storage_config.geometries_path,
config.storage_config.datasource_indexes_path,
config.storage_config.names_data_path,
config.storage_config.properties_path};
for (auto file : required_files)
{
if (!boost::filesystem::is_regular_file(file))
{
util::Log(logWARNING) << file << " is not found";
}
}
}
return EXIT_FAILURE;
}
config.algorithm = stringToAlgorithm(algorithm);