Is there a way to override a specific moment when the slot is called in boost :: signals2 and performs some actions (logging, debugging, exception handling)?
I would like to catch exceptions at the time of the call of the slots, since signals / slots are the place where the execution path in my code crosses various software components, and each component should be optional / may be disabled at runtime if this is incorrect. Therefore, when the call to the slot call (maybe obtained from an external library, maybe just std :: bad_alloc), I would like to receive a notification about this - and find out with which component the signal was sent - so I can kill this component.
I donโt see how to do this in a union because I donโt have access to slots or communication objects there? Therefore, I see no way to get any information. (Changing the return type in each slot is not possible.)
Is there any super easy way to do this that I missed?
If not, how do I do this?
Is the subclass something like slot_call_iterator (for wrapping the call in try / catch) and connection_body_base (for storing information about which component it belongs to, for example) and use them? (How?)
Or a subclass of signal2 :: slot <...>, provide it with information about the owning component in the constructor and somehow overload the operator () (...)? (I donโt know, it also seems to be the hardest part about the magic of the template.)
source share