Add missing files in exception message (#5360)
This commit is contained in:
committed by
GitHub
parent
7f014bd616
commit
e3c7995b00
+7
-2
@@ -10,6 +10,8 @@
|
||||
#include "engine/engine_config.hpp"
|
||||
#include "engine/status.hpp"
|
||||
|
||||
#include <boost/algorithm/string/join.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace osrm
|
||||
@@ -25,8 +27,11 @@ OSRM::OSRM(engine::EngineConfig &config)
|
||||
// First, check that necessary core data is available
|
||||
if (!config.use_shared_memory && !config.storage_config.IsValid())
|
||||
{
|
||||
throw util::exception("Required files are missing, cannot continue. Have all the "
|
||||
"pre-processing steps been run?");
|
||||
const auto &missingFiles = config.storage_config.GetMissingFiles();
|
||||
throw util::exception("Required files are missing, cannot continue. Have all the "
|
||||
"pre-processing steps been run? "
|
||||
"Missing files: " +
|
||||
boost::algorithm::join(missingFiles, ", "));
|
||||
}
|
||||
|
||||
// Now, check that the algorithm requested can be used with the data
|
||||
|
||||
@@ -10,10 +10,11 @@ namespace osrm
|
||||
{
|
||||
namespace storage
|
||||
{
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
bool IOConfig::IsValid() const
|
||||
{
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
bool success = true;
|
||||
for (auto &fileName : required_input_files)
|
||||
{
|
||||
@@ -26,5 +27,18 @@ bool IOConfig::IsValid() const
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
std::vector<std::string> IOConfig::GetMissingFiles() const
|
||||
{
|
||||
std::vector<std::string> missingFiles;
|
||||
for (auto &fileName : required_input_files)
|
||||
{
|
||||
if (!fs::is_regular_file(fs::path(base_path.string() + fileName.string())))
|
||||
{
|
||||
missingFiles.push_back(base_path.string() + fileName.string());
|
||||
}
|
||||
}
|
||||
return missingFiles;
|
||||
}
|
||||
} // namespace storage
|
||||
} // namespace osrm
|
||||
|
||||
Reference in New Issue
Block a user