diff options
author | rebecca “wiggles” turner <rbt@sent.as> | 2024-10-05 17:33:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@localhost> | 2024-10-05 17:33:00 +0000 |
commit | 86b213e6321540328fb11c3ea99c0b24becc45b0 (patch) | |
tree | d110b44daad528a73e4a75ad69f149ea6b7d51ad /src/libutil/error.cc | |
parent | a3dd07535c183433a3f1f97596e9d2b41f8a33ba (diff) | |
parent | ee0c195eba7d16b796fd9883e3fe88c0d64ff0bf (diff) |
Merge "Split ignoreException to avoid suppressing CTRL-C" into main
Diffstat (limited to 'src/libutil/error.cc')
-rw-r--r-- | src/libutil/error.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc index a7cbfbfd0..027f0b1a5 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -4,6 +4,7 @@ #include "position.hh" #include "terminal.hh" #include "strings.hh" +#include "signals.hh" #include <iostream> #include <optional> @@ -416,7 +417,7 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s return out; } -void ignoreException(Verbosity lvl) +void ignoreExceptionInDestructor(Verbosity lvl) { /* Make sure no exceptions leave this function. printError() also throws when remote is closed. */ @@ -429,4 +430,15 @@ 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()); + } +} + } |