summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/auth/authentication.hpp2
-rw-r--r--src/buildtool/serve_api/remote/config.hpp10
2 files changed, 9 insertions, 3 deletions
diff --git a/src/buildtool/auth/authentication.hpp b/src/buildtool/auth/authentication.hpp
index cd4ff86d..f06e6a1c 100644
--- a/src/buildtool/auth/authentication.hpp
+++ b/src/buildtool/auth/authentication.hpp
@@ -84,7 +84,7 @@ class Auth::TLS::Builder final {
/// tls_client_key are set, or none of the two.
/// \return Auth on success, error string on failure, nullopt if no TLS
/// configuration fields were set.
- [[nodiscard]] auto Build() noexcept
+ [[nodiscard]] auto Build() const noexcept
-> std::optional<expected<Auth, std::string>> {
// To not duplicate default arguments of Auth::TLS in builder,
// create a default config and copy default arguments from there.
diff --git a/src/buildtool/serve_api/remote/config.hpp b/src/buildtool/serve_api/remote/config.hpp
index d19e7699..005d56af 100644
--- a/src/buildtool/serve_api/remote/config.hpp
+++ b/src/buildtool/serve_api/remote/config.hpp
@@ -17,6 +17,7 @@
#include <chrono>
#include <cstddef>
+#include <exception>
#include <filesystem>
#include <iterator>
#include <optional>
@@ -93,7 +94,7 @@ class RemoteServeConfig::Builder final {
/// \brief Finalize building and create RemoteServeConfig.
/// \return RemoteServeConfig on success or an error on failure.
- [[nodiscard]] auto Build() noexcept
+ [[nodiscard]] auto Build() const noexcept
-> expected<RemoteServeConfig, std::string> {
// To not duplicate default arguments of RemoteServeConfig in builder,
// create a default config and copy default arguments from there.
@@ -111,7 +112,12 @@ class RemoteServeConfig::Builder final {
auto known_repositories = default_config.known_repositories;
if (known_repositories_.has_value()) {
- known_repositories = std::move(*known_repositories_);
+ try {
+ known_repositories = *known_repositories_;
+ } catch (std::exception const& ex) {
+ return unexpected{
+ std::string("Setting known repositories failed.")};
+ }
}
auto jobs = default_config.jobs;