# HG changeset patch # User John W. Eaton # Date 1454454178 18000 # Node ID 8bec8855e9ce63b5eedc177a4c8910066a6a280b # Parent 3be6a07e8bad31ef1bb86718b487055976fbf46a improve nargin error message (bug #47021) * ov-usr-fcn.cc (Fnargin): Pass true to octave_value::function_value. Display type name in error if object is not a user-defined function. diff -r 3be6a07e8bad -r 8bec8855e9ce libinterp/octave-value/ov-usr-fcn.cc --- a/libinterp/octave-value/ov-usr-fcn.cc Tue Feb 02 17:06:11 2016 -0500 +++ b/libinterp/octave-value/ov-usr-fcn.cc Tue Feb 02 18:02:58 2016 -0500 @@ -832,7 +832,7 @@ error ("nargin: invalid function name: %s", name.c_str ()); } - octave_function *fcn_val = func.function_value (); + octave_function *fcn_val = func.function_value (true); if (! fcn_val) error ("nargin: FCN must be a string or function handle"); @@ -840,9 +840,12 @@ if (! fcn) { - // Matlab gives up for histc, - // so maybe it's ok that that we give up somtimes too? - error ("nargin: nargin 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 ("nargin: number of input arguments unavailable for %s objects", + type.c_str ()); } tree_parameter_list *param_list = fcn->parameter_list ();