Add missing files in exception message (#5360)
This commit is contained in:
parent
7f014bd616
commit
e3c7995b00
@ -4,6 +4,7 @@
|
||||
- FIXED: Use Boost.Beast to parse HTTP request. [#6294](https://github.com/Project-OSRM/osrm-backend/pull/6294)
|
||||
- FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
|
||||
- Misc:
|
||||
- CHANGED: missing files list is included in exception message. [#5360](https://github.com/Project-OSRM/osrm-backend/pull/5360)
|
||||
- CHANGED: Do not use deprecated Callback::Call overload in Node bindings. [#6318](https://github.com/Project-OSRM/osrm-backend/pull/6318)
|
||||
- FIXED: Fix distance calculation consistency. [#6315](https://github.com/Project-OSRM/osrm-backend/pull/6315)
|
||||
- FIXED: Fix performance issue after migration to sol2 3.3.0. [#6304](https://github.com/Project-OSRM/osrm-backend/pull/6304)
|
||||
|
@ -25,6 +25,7 @@ struct IOConfig
|
||||
}
|
||||
|
||||
bool IsValid() const;
|
||||
std::vector<std::string> GetMissingFiles() const;
|
||||
boost::filesystem::path GetPath(const std::string &fileName) const
|
||||
{
|
||||
if (!IsConfigured(fileName, required_input_files) &&
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user