diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2024-06-27 17:44:34 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2024-06-28 11:34:53 +0200 |
commit | 01d9abcfc85d974763c3a7f8fed998342d92a681 (patch) | |
tree | 105a887360a49dfa8bf942f48c5560d29b0dcd6e /src/other_tools/just_mr/setup_utils.cpp | |
parent | f82ee35bff7363e6381d659b26773f260109e2ea (diff) | |
download | justbuild-01d9abcfc85d974763c3a7f8fed998342d92a681.tar.gz |
Use (un)expected for serve API
Diffstat (limited to 'src/other_tools/just_mr/setup_utils.cpp')
-rw-r--r-- | src/other_tools/just_mr/setup_utils.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 4ed6f94d..1c55c9a3 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -259,19 +259,15 @@ auto CreateServeConfig(std::optional<std::string> const& remote_serve_addr, MultiRepoRemoteAuthArguments const& auth) noexcept -> std::optional<RemoteServeConfig> { RemoteServeConfig::Builder builder; - auto result = builder.SetRemoteAddress(remote_serve_addr).Build(); + auto config = builder.SetRemoteAddress(remote_serve_addr).Build(); - if (auto* config = std::get_if<RemoteServeConfig>(&result)) { + if (config) { // setup authentication SetupAuthConfig(auth); - return std::move(*config); + return *std::move(config); } - if (auto* error = std::get_if<std::string>(&result)) { - Logger::Log(LogLevel::Error, *error); - return std::nullopt; - } - Logger::Log(LogLevel::Error, "Unknown error occured"); + Logger::Log(LogLevel::Error, config.error()); return std::nullopt; } |