aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hubrecht <github@mail.hubrecht.ovh>2024-05-28 16:09:33 +0200
committerTom Hubrecht <github@mail.hubrecht.ovh>2024-05-29 11:42:42 +0200
commit93ebb3e7dfb75ce23c1fb46d8e70208a2bad0c02 (patch)
treee9dd046a7650eb9c414550224d8d3f0b0b8737e5
parent8b6d2d39155e88250c576571a1251769b926ee83 (diff)
util.{hh,cc}: Move ignoreException to error.{hh,cc}
Change-Id: Iae6464217a55c313a983e5c651b26a4a1e446706
-rw-r--r--src/libutil/current-process.cc2
-rw-r--r--src/libutil/error.cc13
-rw-r--r--src/libutil/error.hh6
-rw-r--r--src/libutil/util.cc12
-rw-r--r--src/libutil/util.hh7
5 files changed, 20 insertions, 20 deletions
diff --git a/src/libutil/current-process.cc b/src/libutil/current-process.cc
index f9a08685f..c64dd1e0d 100644
--- a/src/libutil/current-process.cc
+++ b/src/libutil/current-process.cc
@@ -1,9 +1,9 @@
#include "current-process.hh"
+#include "error.hh"
#include "file-system.hh"
#include "logging.hh"
#include "namespaces.hh"
#include "signals.hh"
-#include "util.hh"
#include "strings.hh"
#ifdef __APPLE__
diff --git a/src/libutil/error.cc b/src/libutil/error.cc
index f780aabef..1a294bf08 100644
--- a/src/libutil/error.cc
+++ b/src/libutil/error.cc
@@ -417,4 +417,17 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s
return out;
}
+void ignoreException(Verbosity lvl)
+{
+ /* Make sure no exceptions leave this function.
+ printError() also throws when remote is closed. */
+ try {
+ try {
+ throw;
+ } catch (std::exception & e) {
+ printMsg(lvl, "error (ignored): %1%", e.what());
+ }
+ } catch (...) { }
+}
+
}
diff --git a/src/libutil/error.hh b/src/libutil/error.hh
index 323365d65..0884f9f32 100644
--- a/src/libutil/error.hh
+++ b/src/libutil/error.hh
@@ -202,4 +202,10 @@ public:
}
};
+/**
+ * Exception handling in destructors: print an error message, then
+ * ignore the exception.
+ */
+void ignoreException(Verbosity lvl = lvlError);
+
}
diff --git a/src/libutil/util.cc b/src/libutil/util.cc
index 6d6e55ad1..d9bd71b5f 100644
--- a/src/libutil/util.cc
+++ b/src/libutil/util.cc
@@ -70,18 +70,6 @@ namespace nix {
-void ignoreException(Verbosity lvl)
-{
- /* Make sure no exceptions leave this function.
- printError() also throws when remote is closed. */
- try {
- try {
- throw;
- } catch (std::exception & e) {
- printMsg(lvl, "error (ignored): %1%", e.what());
- }
- } catch (...) { }
-}
//////////////////////////////////////////////////////////////////////
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 867f0a80d..c5ca12650 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -39,13 +39,6 @@ struct Source;
extern const std::string nativeSystem;
-/**
- * Exception handling in destructors: print an error message, then
- * ignore the exception.
- */
-void ignoreException(Verbosity lvl = lvlError);
-
-
/**
* Get a value for the specified key from an associate container.