# HG changeset patch # User John W. Eaton # Date 1454475105 18000 # Node ID a428c6ba63344734b9ea045928738aeb62af2740 # Parent 8bec8855e9ce63b5eedc177a4c8910066a6a280b improve nargout error message (bug #47021) * ov-usr-fcn.cc (Fnargout): Pass true to octave_value::function_value. Display type name in error if object is not a user-defined function. diff -r 8bec8855e9ce -r a428c6ba6334 libinterp/octave-value/ov-usr-fcn.cc --- a/libinterp/octave-value/ov-usr-fcn.cc Tue Feb 02 18:02:58 2016 -0500 +++ b/libinterp/octave-value/ov-usr-fcn.cc Tue Feb 02 23:51:45 2016 -0500 @@ -951,7 +951,7 @@ return ovl (-1); } - octave_function *fcn_val = func.function_value (); + octave_function *fcn_val = func.function_value (true); if (! fcn_val) error ("nargout: FCN must be a string or function handle"); @@ -959,11 +959,12 @@ if (! fcn) { - // JWE said this information is not available (2011-03-10) - // without making intrusive changes to Octave. - // Matlab gives up for histc, - // so maybe it's ok that we give up somtimes too? - error ("nargout: nargout information not available for built-in functions."); + // Matlab gives up for histc, so maybe it's ok that that we + // give up sometimes too? + + std::string type = fcn_val->type_name (); + error ("nargout: number of output arguments unavailable for %s objects", + type.c_str ()); } tree_parameter_list *ret_list = fcn->return_list ();