From 555181c3fd6c6ee4417e093abf556a319e720d3c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 29 Mar 2024 15:30:43 -0400 Subject: [PATCH] `throwExceptionSelfCheck` throw `Error` `SysError` is not appropriate because there is no (Unix) syscall involved. The catch block in `initLibUtil` is already for `Error` and still works. --- src/libutil/error.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 036e19e26fb..fd4f4efd187 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -16,9 +16,10 @@ void BaseError::addTrace(std::shared_ptr && e, HintFmt hint, TracePrint pri err.traces.push_front(Trace { .pos = std::move(e), .hint = hint, .print = print }); } -void throwExceptionSelfCheck(){ +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."); + throw Error("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.