summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/file_system')
-rw-r--r--src/buildtool/file_system/TARGETS7
-rw-r--r--src/buildtool/file_system/file_root.hpp15
-rw-r--r--src/buildtool/file_system/precomputed_root.hpp31
3 files changed, 49 insertions, 4 deletions
diff --git a/src/buildtool/file_system/TARGETS b/src/buildtool/file_system/TARGETS
index cdd5bce7..e6d3104f 100644
--- a/src/buildtool/file_system/TARGETS
+++ b/src/buildtool/file_system/TARGETS
@@ -204,7 +204,12 @@
, "name": ["precomputed_root"]
, "hdrs": ["precomputed_root.hpp"]
, "srcs": ["precomputed_root.cpp"]
- , "deps": [["@", "json", "", "json"], ["src/utils/cpp", "expected"]]
+ , "deps":
+ [ ["@", "json", "", "json"]
+ , ["src/buildtool/logging", "log_level"]
+ , ["src/buildtool/logging", "logging"]
+ , ["src/utils/cpp", "expected"]
+ ]
, "private-deps":
[ ["@", "fmt", "", "fmt"]
, ["@", "gsl", "", "gsl"]
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp
index 3384f55e..f8daa429 100644
--- a/src/buildtool/file_system/file_root.hpp
+++ b/src/buildtool/file_system/file_root.hpp
@@ -183,7 +183,20 @@ class FileRoot {
friend auto operator==(Iterator const& x,
Iterator const& y) noexcept -> bool {
- return x.it_ == y.it_;
+ try {
+ return x.it_ == y.it_;
+ } catch (std::exception const& e) {
+ try {
+ Logger::Log(LogLevel::Error,
+ "Unexpected excpetion: {}",
+ e.what());
+ std::terminate();
+ } catch (...) {
+ std::terminate();
+ }
+ } catch (...) {
+ std::terminate();
+ }
}
friend auto operator!=(Iterator const& x,
Iterator const& y) noexcept -> bool {
diff --git a/src/buildtool/file_system/precomputed_root.hpp b/src/buildtool/file_system/precomputed_root.hpp
index f95f7d73..a405d680 100644
--- a/src/buildtool/file_system/precomputed_root.hpp
+++ b/src/buildtool/file_system/precomputed_root.hpp
@@ -16,6 +16,7 @@
#define INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_PRECOMPUTED_ROOT_HPP
#include <cstddef>
+#include <exception>
#include <functional>
#include <optional>
#include <string>
@@ -23,6 +24,8 @@
#include <variant>
#include "nlohmann/json.hpp"
+#include "src/buildtool/logging/log_level.hpp"
+#include "src/buildtool/logging/logger.hpp"
#include "src/utils/cpp/expected.hpp"
struct ComputedRoot final {
@@ -86,11 +89,35 @@ class PrecomputedRoot final {
[[nodiscard]] auto operator==(PrecomputedRoot const& other) const noexcept
-> bool {
- return root_ == other.root_;
+ try {
+ return root_ == other.root_;
+ } catch (std::exception const& e) {
+ try {
+ Logger::Log(
+ LogLevel::Error, "Unexpected excpetion: {}", e.what());
+ std::terminate();
+ } catch (...) {
+ std::terminate();
+ }
+ } catch (...) {
+ std::terminate();
+ }
}
[[nodiscard]] auto operator<(PrecomputedRoot const& other) const noexcept
-> bool {
- return root_ < other.root_;
+ try {
+ return root_ < other.root_;
+ } catch (std::exception const& e) {
+ try {
+ Logger::Log(
+ LogLevel::Error, "Unexpected excpetion: {}", e.what());
+ std::terminate();
+ } catch (...) {
+ std::terminate();
+ }
+ } catch (...) {
+ std::terminate();
+ }
}
[[nodiscard]] auto ToString() const noexcept -> std::string;