필터 지우기
필터 지우기

Include variable value when throwing exception

조회 수: 4 (최근 30일)
Jurgen vL
Jurgen vL 2019년 5월 21일
댓글: Marc Youcef 2020년 3월 22일
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?
  댓글 수: 1
Marc Youcef
Marc Youcef 2020년 3월 22일
I was looking for same thing as well. I hav objects being instantiated in a loop and when it fails I would like to know which index of instantiation failed.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by