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