Add exception handling to signal emission #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
operator()
method insidesignal.hpp
and new test cases have been added to handle the functionality of exceptions when signals are emitted. Now the function returns a vector ofstd::exception_ptr
s for any exceptions that occurred during the signal emission.Since this is an ABI breaking change, the version has been updated to 2.0.0.
I am resurrecting the concept of #30, and updating it so that users can get the exceptions that were thrown, instead of completely swallowing them. This is meant to help my company replace an old eventing system with sigslot, which we already use. This system currently uses a signal from before we could use packages, and so in order to upgrade completely to sigslot we have to maintain behavior. We have decided that exceptions must be thrown from those connected exceptions, and the current system accumulates exceptions to call all connected slots. While this could also be solved by creating wrapper functions that swallow exceptions, this gives an effective mechanism for all users to maintain some more information from their signals, while not throwing potentially "random" or unexpected exceptions from consumers.