From 01d9abcfc85d974763c3a7f8fed998342d92a681 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Thu, 27 Jun 2024 17:44:34 +0200 Subject: Use (un)expected for serve API --- src/other_tools/just_mr/setup_utils.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/other_tools/just_mr/setup_utils.cpp') 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 const& remote_serve_addr, MultiRepoRemoteAuthArguments const& auth) noexcept -> std::optional { 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(&result)) { + if (config) { // setup authentication SetupAuthConfig(auth); - return std::move(*config); + return *std::move(config); } - if (auto* error = std::get_if(&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; } -- cgit v1.2.3