aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.cc
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-08-11 17:22:55 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-08-11 17:25:42 +0200
commitc4dbb55ba93c9c81d798faa6a19285ebe2717a25 (patch)
treef1b6af5ceb18a01ae860a476289d70707a614546 /src/libutil/error.cc
parent010dc7958e23dd8acc72a154e40a6ce5761dccdf (diff)
initLibUtil: Add exception handling self-check
Diffstat (limited to 'src/libutil/error.cc')
-rw-r--r--src/libutil/error.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc
index c9d61942a..4a1b346ef 100644
--- a/src/libutil/error.cc
+++ b/src/libutil/error.cc
@@ -14,6 +14,11 @@ void BaseError::addTrace(std::shared_ptr<AbstractPos> && e, hintformat hint, boo
err.traces.push_front(Trace { .pos = std::move(e), .hint = hint, .frame = frame });
}
+void throwExceptionSelfCheck(){
+ // This is meant to be caught in initLibUtil()
+ throw SysError("C++ exception handling is broken. This would appear to be a problem with the way Nix was compiled and/or linked and/or loaded.");
+}
+
// c++ std::exception descendants must have a 'const char* what()' function.
// This stringifies the error and caches it for use by what(), or similarly by msg().
const std::string & BaseError::calcWhat() const