Mercurial > hg > octave-avbm
changeset 16046:1678d0fca146 stable
fix ErrorHandler in cellfun (bug #38256)
* cellfun.cc: The ErrorHandler was not executed on some errors that
throw an expection. Test added.
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Mon, 11 Feb 2013 13:26:44 -0500 |
parents | 8cf7db67c1a2 |
children | a1e67cf915ba c5b4b9507a55 69c0728def22 |
files | src/DLD-FUNCTIONS/cellfun.cc |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/cellfun.cc +++ b/src/DLD-FUNCTIONS/cellfun.cc @@ -69,7 +69,14 @@ octave_value& func, octave_value& error_handler) { - octave_value_list tmp = func.do_multi_index_op (nargout, inputlist); + octave_value_list tmp; + try { + tmp = func.do_multi_index_op (nargout, inputlist); + } + catch (octave_execution_exception) { + if (error_handler.is_defined ()) + error_state = 1; + } if (error_state) { @@ -1001,6 +1008,7 @@ %!assert(cellfun(@atan2,{1,1;1,1},{1,2;1,2}),atan2([1,1;1,1],[1,2;1,2])) %!error(cellfun(@factorial,{-1,3})) %!assert(cellfun(@factorial,{-1,3},'ErrorHandler',@(x,y) NaN),[NaN,6]) +%!assert (cellfun (@(x) x(2),{[1],[1,2]},"ErrorHandler",@(x,y) NaN), [NaN,2]) %!test %! [a,b,c]=cellfun(@fileparts,{fullfile("a","b","c.d"),fullfile("e","f","g.h")},'UniformOutput',false); %! assert(a,{fullfile("a","b"),fullfile("e","f")})