diff options
author | Tom Hubrecht <github@mail.hubrecht.ovh> | 2024-05-28 16:09:33 +0200 |
---|---|---|
committer | Tom Hubrecht <github@mail.hubrecht.ovh> | 2024-05-29 11:42:42 +0200 |
commit | 93ebb3e7dfb75ce23c1fb46d8e70208a2bad0c02 (patch) | |
tree | e9dd046a7650eb9c414550224d8d3f0b0b8737e5 /src/libutil/error.cc | |
parent | 8b6d2d39155e88250c576571a1251769b926ee83 (diff) |
util.{hh,cc}: Move ignoreException to error.{hh,cc}
Change-Id: Iae6464217a55c313a983e5c651b26a4a1e446706
Diffstat (limited to 'src/libutil/error.cc')
-rw-r--r-- | src/libutil/error.cc | 13 |
1 files changed, 13 insertions, 0 deletions
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 (...) { } +} + } |