1 ## Copyright (C) 1995-2012 John W. Eaton
3 ## This file is part of Octave.
5 ## Octave is free software; you can redistribute it and/or modify it
6 ## under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3 of the License, or (at
8 ## your option) any later version.
10 ## Octave is distributed in the hope that it will be useful, but
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ## General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with Octave; see the file COPYING. If not, see
17 ## <http://www.gnu.org/licenses/>.
20 ## @deftypefn {Function File} {} strerror (@var{name}, @var{num})
21 ## Return the text of an error message for function @var{name}
22 ## corresponding to the error number @var{num}. This function is intended
23 ## to be used to print useful error messages for those functions that
24 ## return numeric error codes.
29 function msg = strerror (name, num)
31 persistent warned = false;
34 warning ("Octave:deprecated-function",
35 "strerror is obsolete and will be removed from a future version of Octave.");
43 error ("strerror: first argument must be a string");
47 error ("strerror: second argument must be a scalar");
50 if (strcmp (name, "fsolve"))
53 msg = "input error\n";
55 msg = "error encountered in user-supplied function\n";
57 msg = "solution converged to requested tolerance\n";
59 msg = "iteration is not making good progress\n";
61 msg = "iteration limit exceeded\n";
63 error ("strerror: unrecognized error code for fsolve");
68 error ("strerror: unrecognized function NAME");