aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-21 23:06:00 +0100
committereldritch horrors <pennae@lix.systems>2024-03-31 13:42:01 +0000
commitdd06f9b792638b9c48265b223d095859990d3b26 (patch)
tree215344ffc0a88b8880bcde05b8fe6f9be6b5d84e /src/libutil
parentc777dcd1ae2f25db3d5c6e828178428f7d594583 (diff)
libutil: make ~Finally noexcept(false)
this is supposed to act like a finally block does in other languages. a finally block should be able to throw exceptions of its own rather than just crashing the entire program when it throws it own exceptions. even in the rare case of a finally throwing an unexpected exception it might be better to report the exception from Finally instead of the original, at least that can keep our program running instead of letting it crash. Change-Id: Id42011e46b1df369152b4564938c0e93fa1acf32
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/finally.hh2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libutil/finally.hh b/src/libutil/finally.hh
index 49263ee6d..f2293e5d4 100644
--- a/src/libutil/finally.hh
+++ b/src/libutil/finally.hh
@@ -19,5 +19,5 @@ public:
Finally(Finally &&other) : fun(std::move(other.fun)) {
other.movedFrom = true;
}
- ~Finally() { if (!movedFrom) fun(); }
+ ~Finally() noexcept(false) { if (!movedFrom) fun(); }
};