From c4dbb55ba93c9c81d798faa6a19285ebe2717a25 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 11 Aug 2023 17:22:55 +0200 Subject: initLibUtil: Add exception handling self-check --- src/libutil/error.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/libutil/error.cc') 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 && 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 -- cgit v1.2.3