Mercurial > octave-nkf
diff libinterp/corefcn/spparms.cc @ 20617:ba2b07c13913
use new string_value method to handle value extraction errors
* __dispatch__.cc, balance.cc, colloc.cc, conv2.cc, data.cc, debug.cc,
graphics.cc, input.cc, matrix_type.cc, oct-hist.cc, schur.cc,
spparms.cc, symtab.cc, sysdep.cc, toplev.cc, utils.cc:
Use new string_value method.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 09 Oct 2015 10:06:39 -0400 |
parents | 4f45eaf83908 |
children |
line wrap: on
line diff
--- a/libinterp/corefcn/spparms.cc Thu Oct 08 19:00:51 2015 -0400 +++ b/libinterp/corefcn/spparms.cc Fri Oct 09 10:06:39 2015 -0400 @@ -167,21 +167,16 @@ } else if (nargin == 2) { - if (args(0).is_string ()) - { - std::string str = args(0).string_value (); + std::string str = args(0).string_value ("spparms: first argument must be a string"); - double val = args(1).double_value (); + double val = args(1).double_value (); - if (error_state) - error ("spparms: second argument must be a real scalar"); - else if (str == "umfpack") - warning ("spparms: request to disable umfpack solvers ignored"); - else if (!octave_sparse_params::set_key (str, val)) - error ("spparms: KEY not found"); - } - else - error ("spparms: first argument must be a string"); + if (error_state) + error ("spparms: second argument must be a real scalar"); + else if (str == "umfpack") + warning ("spparms: request to disable umfpack solvers ignored"); + else if (!octave_sparse_params::set_key (str, val)) + error ("spparms: KEY not found"); } else error ("spparms: too many input arguments");