forked from lix-project/lix
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
This commit is contained in:
parent
0b77ba6980
commit
a5e40bf4fe
|
@ -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(); }
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue