[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with try/catch statement: catch clause not evaluated
From: |
Michael Goffioul |
Subject: |
Problem with try/catch statement: catch clause not evaluated |
Date: |
Fri, 7 Sep 2007 15:34:33 +0200 |
Hi,
I have a problem with try/catch statement: when this is executed
within a JHandles callback, the catch clause does not seem to be
evaluated. I defined a function like the following:
===================================
function test1
try
printf('trying to evaluate "sin(''1'')"\n');
fflush(stdout);
sin('1');
printf('"sin(''1'')" evaluated\n');
fflush(stdout);
catch
printf('error catched\n');
fflush(stdout);
end
endfunction
===================================
Calling it from octave prompt produces the expected result (the catch
clause got evaluated). Now if I create a push button and assign test1 as
callback, like in
h = uicontrol('string', 'OK', 'callback', @(h) test1)
(Note: I also tried with @test1, this doesn't make any difference)
and push the button, the try clause is evaluated up to the "sin" call,
then nothing more. The catch clause is not evaluated. The callback
execution is done in the main octave thread, during a readline input
event hook (set in __java__.cc through command_editor::set_event_hook),
using "feval".
Do I need to set some special environment before calling "feval" in
order to have correct behavior?
Michael.
- Problem with try/catch statement: catch clause not evaluated,
Michael Goffioul <=