Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing files in exception message #5360

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions include/storage/io_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) &&
Expand Down
9 changes: 7 additions & 2 deletions src/osrm/osrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "engine/engine_config.hpp"
#include "engine/status.hpp"

#include <boost/algorithm/string/join.hpp>

#include <memory>

namespace osrm
Expand All @@ -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
Expand Down
18 changes: 16 additions & 2 deletions src/storage/io_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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