mirror of
https://github.com/NixOS/nix
synced 2025-07-04 03:01:47 +02:00
Split ignoreException for destructors or interrupt-safe
This commit is contained in:
parent
a1415471b8
commit
3df619339c
27 changed files with 164 additions and 125 deletions
|
@ -1,6 +1,7 @@
|
|||
#include "util.hh"
|
||||
#include "fmt.hh"
|
||||
#include "file-path.hh"
|
||||
#include "signals.hh"
|
||||
|
||||
#include <array>
|
||||
#include <cctype>
|
||||
|
@ -182,7 +183,7 @@ std::string shellEscape(const std::string_view s)
|
|||
}
|
||||
|
||||
|
||||
void ignoreException(Verbosity lvl)
|
||||
void ignoreExceptionInDestructor(Verbosity lvl)
|
||||
{
|
||||
/* Make sure no exceptions leave this function.
|
||||
printError() also throws when remote is closed. */
|
||||
|
@ -195,6 +196,17 @@ void ignoreException(Verbosity lvl)
|
|||
} catch (...) { }
|
||||
}
|
||||
|
||||
void ignoreExceptionExceptInterrupt(Verbosity lvl)
|
||||
{
|
||||
try {
|
||||
throw;
|
||||
} catch (const Interrupted & e) {
|
||||
throw;
|
||||
} catch (std::exception & e) {
|
||||
printMsg(lvl, "error (ignored): %1%", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
constexpr char base64Chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue