Global exception handling in a GUI class
2 views (last 30 days)
Show older comments
Hi,
I have a class that represents a GUI window and want to display any kind of exception that occurs in any class method as a errordlg (as console output ist not useful when using a gui).
- Is there a convenient way to redirect all exception-message-strings to the function errordlg()?
- This should especially include all errors that occur within any class method (like a call to obj.methodXY())
- It is desireable to catch also other errors (like wrong use of obj(..))
I have already tried overloading B=subsref(A,S), but this causes vast problems when methods with/without input-/output-arguments are called.
Answers (1)
Sean de Wolski
on 17 Sep 2013
Edited: Sean de Wolski
on 17 Sep 2013
I don't think there is a way to redirect from standard error to error dialog. You'll have to catch the MException and then throw the error dialog from there. This could be packaged as a function to make it reusable.
2 Comments
Sean de Wolski
on 17 Sep 2013
I guess I don't understand how subsref would be called from a user using the figure/GUI/app.
Wouldn't whatever the user is doing be safeguarded against at that level? How are they going to use subsref?
See Also
Categories
Find more on String Parsing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!