<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240541</link>
    <title>MATLAB Central Newsreader - How to get debug to catch errors in listener callbacks?</title>
    <description>Feed for thread: How to get debug to catch errors in listener callbacks?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sat, 06 Dec 2008 01:14:17 -0500</pubDate>
      <title>How to get debug to catch errors in listener callbacks?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240541#615388</link>
      <author>Nick</author>
      <description>Say I add a listener to an event called 'hello', defined for some object, 'obj':&lt;br&gt;
&lt;br&gt;
addlistener(obj, 'hello', @(src, evnt)MyLazyCallback(src, evnt, data));&lt;br&gt;
&lt;br&gt;
Now, if there is an error in MyLazyCallback, my Matlab only catches the error at the line where obj is notified:&lt;br&gt;
&lt;br&gt;
-&amp;gt;notify(obj, 'hello')&lt;br&gt;
&lt;br&gt;
My question:&lt;br&gt;
&lt;br&gt;
Is there any way to get Matlab to error inside MyLazyCallback?  It's a bit of a pain right now as I have to go through every callback listening to that event to find the error...&lt;br&gt;
&lt;br&gt;
Cheers,&lt;br&gt;
Nick</description>
    </item>
    <item>
      <pubDate>Mon, 08 Dec 2008 16:10:12 -0500</pubDate>
      <title>Re: How to get debug to catch errors in listener callbacks?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240541#615701</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Nick&quot; &amp;lt;nickchng@gmail.com&amp;gt; wrote in message &lt;br&gt;
news:12196427.1228526088516.JavaMail.jakarta@nitrogen.mathforum.org...&lt;br&gt;
&amp;gt; Say I add a listener to an event called 'hello', defined for some object, &lt;br&gt;
&amp;gt; 'obj':&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; addlistener(obj, 'hello', @(src, evnt)MyLazyCallback(src, evnt, data));&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Now, if there is an error in MyLazyCallback, my Matlab only catches the &lt;br&gt;
&amp;gt; error at the line where obj is notified:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; -&amp;gt;notify(obj, 'hello')&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; My question:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Is there any way to get Matlab to error inside MyLazyCallback?  It's a bit &lt;br&gt;
&amp;gt; of a pain right now as I have to go through every callback listening to &lt;br&gt;
&amp;gt; that event to find the error...&lt;br&gt;
&lt;br&gt;
I haven't tried this inside a listener function, but DBSTOP IF ERROR or &lt;br&gt;
DBSTOP IF CAUGHT ERROR may do what you want (and if you know the error &lt;br&gt;
identifier for the error that's being thrown by MyLazyCallback, you can &lt;br&gt;
specify that to control with more granularity where DBSTOP stops.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/ref/dbstop.html&quot;&gt;http://www.mathworks.com/access/helpdesk/help/techdoc/ref/dbstop.html&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Mon, 08 Dec 2008 19:50:23 -0500</pubDate>
      <title>Re: How to get debug to catch errors in listener callbacks?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240541#615764</link>
      <author>Nick</author>
      <description>Thanks for the response Steve, &lt;br&gt;
&lt;br&gt;
Unfortunately the type of error thrown by 'MyLazyCallback' is not reported, just that there is an error at the notify line.  This is also where all the debugging tools will stop/catch any errors.  Thus far I've just been commenting each of my notify commands with a list of all listeners to remind me in case something goes awry.</description>
    </item>
    <item>
      <pubDate>Sat, 01 Aug 2009 17:40:19 -0400</pubDate>
      <title>Re: How to get debug to catch errors in listener callbacks?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240541#670016</link>
      <author>Jacob Katz</author>
      <description>Did you ever find a solution to this problem?  I am running into the same difficulty and I would be happy to find a more elegant solution than adding comments.&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;
&lt;br&gt;
Nick &amp;lt;nickchng@gmail.com&amp;gt; wrote in message &amp;lt;24234126.1228765854213.JavaMail.jakarta@nitrogen.mathforum.org&amp;gt;...&lt;br&gt;
&amp;gt; Thanks for the response Steve, &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Unfortunately the type of error thrown by 'MyLazyCallback' is not reported, just that there is an error at the notify line.  This is also where all the debugging tools will stop/catch any errors.  Thus far I've just been commenting each of my notify commands with a list of all listeners to remind me in case something goes awry.</description>
    </item>
    <item>
      <pubDate>Wed, 05 Aug 2009 01:10:07 -0400</pubDate>
      <title>Re: How to get debug to catch errors in listener callbacks?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240541#670659</link>
      <author>Ryan Ollos</author>
      <description>&quot;Jacob Katz&quot; &amp;lt;idahopotato_removeme_@gmail.com&amp;gt; wrote in message &amp;lt;h51um3$2fl$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Did you ever find a solution to this problem?  I am running into the same difficulty and I would be happy to find a more elegant solution than adding comments.&lt;br&gt;
&lt;br&gt;
I think it would be worth talking with Mathworks technical support.  I'd be happy to open a case with them, but we should probably put together a simple example to demonstrate the issue.  All of the cases I have that might demonstrate the issue are pretty extensive pieces of code.</description>
    </item>
    <item>
      <pubDate>Wed, 28 Oct 2009 04:46:01 -0400</pubDate>
      <title>Re: How to get debug to catch errors in listener callbacks?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/240541#690209</link>
      <author>Ryan Ollos</author>
      <description>&quot;Jacob Katz&quot; &amp;lt;idahopotato_removeme_@gmail.com&amp;gt; wrote in message &amp;lt;h51um3$2fl$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Did you ever find a solution to this problem?  I am running into the same difficulty and I would be happy to find a more elegant solution than adding comments.&lt;br&gt;
&lt;br&gt;
I believe this has been fixed as of r2009b.</description>
    </item>
  </channel>
</rss>

