MATLAB: When does DBSTOP not apply to callbacks

callbacksdatatipdbstopdebuggergraphics

I find (in R2013b, R2014b) that when I make the debugger active with
>> dbstop if error
that errors in certain callback functions fail to trigger debug mode. In particular, when I run the test() mfunction below and place a datatip in the figure it generates, the datatip text shows "Error in custom datatip string function".
function test
X=rand(100);
imagesc(X);
hdt = datacursormode(gcf);
set(hdt,'UpdateFcn',@tipcallback);
figure(gcf);
datacursormode on
function output_txt = tipcallback(obj,event_obj)
output_txt=whatever; %<--Debug mode should trigger here
I do expect an error to occur at the line indicated in tipcallback() because a non-existent variable "whatever" is referenced there. However, because I have used DBSTOP, I expect to get the K>> prompt at the indicated line. Yet, debug mode is never triggered. Is it due to some special behavior of callback functions? If so, why do I see this problem only in the datacursormode's 'UpdateFcn' callback?

Best Answer

Does dbstop if caught error trigger it? It's likely there's a try/catch catching the original exception and thus not throwing one to be stopped on. dbstop if caught error will catch this too.
Related Question