summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/update.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/just_mr/update.cpp')
-rw-r--r--src/other_tools/just_mr/update.cpp34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/other_tools/just_mr/update.cpp b/src/other_tools/just_mr/update.cpp
index 8d34de01..38fac998 100644
--- a/src/other_tools/just_mr/update.cpp
+++ b/src/other_tools/just_mr/update.cpp
@@ -14,8 +14,12 @@
#include "src/other_tools/just_mr/update.hpp"
+#include <atomic>
+#include <condition_variable>
#include <cstddef>
+#include <exception>
#include <filesystem>
+#include <thread>
#include "fmt/core.h"
#include "nlohmann/json.hpp"
@@ -233,13 +237,29 @@ auto MultiRepoUpdate(std::shared_ptr<Configuration> const& config,
git_update_map.ConsumeAfterKeysReady(
&ts,
repos_to_update,
- [&mr_config, repos_to_update_names = update_args.repos_to_update](
- auto const& values) {
- for (auto const& repo_name : repos_to_update_names) {
- auto i = static_cast<std::size_t>(
- &repo_name - &repos_to_update_names[0]); // get index
- mr_config["repositories"][repo_name]["repository"]
- ["commit"] = *values[i];
+ [&failed,
+ &mr_config,
+ repos_to_update_names = update_args.repos_to_update,
+ multi_repo_tool_name](auto const& values) noexcept {
+ try {
+ for (auto const& repo_name : repos_to_update_names) {
+ auto i = static_cast<std::size_t>(
+ &repo_name -
+ &repos_to_update_names[0]); // get index
+ // we know "repository" is a map for repo_name, so
+ // field "commit" is here either overwritten or set if
+ // missing; either way, this should always work
+ mr_config["repositories"][repo_name]["repository"]
+ ["commit"] = *values[i];
+ }
+ } catch (std::exception const& ex) {
+ Logger::Log(
+ LogLevel::Error,
+ "While performing {} update:\nUpdating configuration "
+ "fields failed with:\n{}",
+ multi_repo_tool_name,
+ ex.what());
+ failed = true;
}
},
[&failed, &multi_repo_tool_name](auto const& msg, bool fatal) {