util.{hh,cc}: Move ignoreException to error.{hh,cc}
Change-Id: Iae6464217a55c313a983e5c651b26a4a1e446706
This commit is contained in:
parent
8b6d2d3915
commit
93ebb3e7df
5 changed files with 20 additions and 20 deletions
|
@ -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__
|
||||
|
|
|
@ -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 (...) { }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -202,4 +202,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Exception handling in destructors: print an error message, then
|
||||
* ignore the exception.
|
||||
*/
|
||||
void ignoreException(Verbosity lvl = lvlError);
|
||||
|
||||
}
|
||||
|
|
|
@ -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 (...) { }
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue