title: Escape from nested try - catch statement
body: <p>I am currently debugging code with nested try-catch statements.</p>
  
  <p>I can easily handle the errors with the <code>dbstop</code> command, but each time I look at the code and want to stop running the program, I have to enter <code>dbquit</code> once for each nesting level.</p>
  
  <p>As this is quite annoying I am looking for a solution to really stop debugging all programs once I am done debugging.</p>
  
  <p>Here is an example of how I call the code:</p>
  
  <pre><code>dbstop if error
  dbstop if caught error
  mytestmain
  </code></pre>
  
  <p>And here is an example of what the function could look like (the subfunction may or may not be in a different .m file)</p>
  
  <pre><code>function mytestmain 
  try
      mytestsub
  catch
  end
  
  %% Definition of subfunction
  function mytestsub
  try
      a=b;%generate an error as b is not defined
  catch
  end
  </code></pre>
  
  <hr>
  
  <p>What have I tried?</p>
  
  <ul>
  <li>I tried using a script or a function that calls <code>dbquit</code> twice, however this will only execute <code>dbquit</code> once.</li>
  <li>I tried using <code>dbquit('all')</code>, but with no effect</li>
  </ul>
  
  <hr>
  
  <p>Note that I prefer not to remove the try-catch statements in the code.</p>