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.