MATLAB Answers

0

Include variable value when throwing exception

Asked by Jurgen vL on 21 May 2019
I have a function that throws a specific exception, and a try/catch block in a top-level function that handles it. I want to pass along the value of some variables in addition to the error message for debugging purposes. Typically cell array, string array or numerical matrix.
I'm guessing I would have to create a custom exception class for this?
Follow-up: Why is the default MException so restrictive? Is error handling like I described a bad practice?

  0 Comments

Sign in to comment.

Products


Release

R2018b

0 Answers