How to handle error in callback function triggered by an event?
Show older comments
Hi All,
I have an instance of a class I created that can trigger events. I have other classes that set listeners on this object and execute some stuff in a callback function. The callback function may do some error checking and use the error() function to raise an exception if there is an issue. What I was hoping for is that when this happens, that MATLAB would cease executing any remaining listeners as well as the function that triggered the event.
However, from the MATLAB documentation,
Callback function execution continues until the function completes. If an error occurs in a callback function, execution stops and control returns to the calling function. Then any remaining listener callback functions execute.
So what I can do to get around this? Should I be using something other than an event in this case?
Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on COM Component Integration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!