Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exception handling to signal emission #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sylvyrfysh
Copy link

@Sylvyrfysh Sylvyrfysh commented Dec 28, 2023

The operator() method inside signal.hpp and new test cases have been added to handle the functionality of exceptions when signals are emitted. Now the function returns a vector of std::exception_ptrs 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.

The `operator()` method inside `signal.hpp` and new test cases have been added to handle the functionality of exceptions when signals are emitted. Now the function returns a vector of `std::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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant