aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.hh
diff options
context:
space:
mode:
authorrebecca “wiggles” turner <rbt@sent.as>2024-10-05 17:33:00 +0000
committerGerrit Code Review <gerrit@localhost>2024-10-05 17:33:00 +0000
commit86b213e6321540328fb11c3ea99c0b24becc45b0 (patch)
treed110b44daad528a73e4a75ad69f149ea6b7d51ad /src/libutil/error.hh
parenta3dd07535c183433a3f1f97596e9d2b41f8a33ba (diff)
parentee0c195eba7d16b796fd9883e3fe88c0d64ff0bf (diff)
Merge "Split ignoreException to avoid suppressing CTRL-C" into main
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r--src/libutil/error.hh17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh
index 73c1ccadd..4eff2c2bc 100644
--- a/src/libutil/error.hh
+++ b/src/libutil/error.hh
@@ -204,7 +204,22 @@ public:
/**
* Exception handling in destructors: print an error message, then
* ignore the exception.
+ *
+ * If you're not in a destructor, you usually want to use `ignoreExceptionExceptInterrupt()`.
+ *
+ * This function might also be used in callbacks whose caller may not handle exceptions,
+ * but ideally we propagate the exception using an exception_ptr in such cases.
+ * See e.g. `PackBuilderContext`
+ */
+void ignoreExceptionInDestructor(Verbosity lvl = lvlError);
+
+/**
+ * Not destructor-safe.
+ * Print an error message, then ignore the exception.
+ * If the exception is an `Interrupted` exception, rethrow it.
+ *
+ * This may be used in a few places where Interrupt can't happen, but that's ok.
*/
-void ignoreException(Verbosity lvl = lvlError);
+void ignoreExceptionExceptInterrupt(Verbosity lvl = lvlError);
}