フィルターのクリア

How to obtain an MException in a cleanup function

3 ビュー (過去 30 日間)
Matt
Matt 2020 年 10 月 26 日
編集済み: Matt 2020 年 10 月 28 日
Hi all,
I've noticed that "lasterror" indicates that it will be obsolete soon, and MException.last indications that it can only be used from the command line. Without using a try/catch construct in the calling/parent function that is being cleaned up, is there any good way to check to see if the calling function being cleaned up generated an error?
  14 件のコメント
Steven Lord
Steven Lord 2020 年 10 月 27 日
If you want to unconditionally stop in the catch block, add a call to keyboard.
Matt
Matt 2020 年 10 月 28 日
編集済み: Matt 2020 年 10 月 28 日
Hi Steven, the two needed behaviors (in order of importance) are
1) To unconditionally stop where a crash occurs (or at least in the same workspace), when the crash occurs, the first time the crash occurs. This is doable with dbstop if error if there isn't a try/catch statement. Try catch doesn't support it.*
2) Log exceptions when they occur. Currently the lasterror function allows a flawed but useable implementation of this.
*Try catch doesn't support this because keyboards or rethrows will cause the debugger to stop in the workspace where the try/catch block is, not where the exception originally occured in the users code. dbstop if caught error does nominally supports this, but as I mentioned above its really not useable in its current state because it catches exceptions in the try/catch blocks in built in code.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

タグ

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by