diff libinterp/corefcn/input.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 f90c8372b7ba
children
line wrap: on
line diff
--- a/libinterp/corefcn/input.cc	Thu Oct 08 19:00:51 2015 -0400
+++ b/libinterp/corefcn/input.cc	Fri Oct 09 10:06:39 2015 -0400
@@ -688,13 +688,7 @@
   if (nargin == 2)
     read_as_string++;
 
-  std::string prompt = args(0).string_value ();
-
-  if (error_state)
-    {
-      error ("input: unrecognized argument");
-      return retval;
-    }
+  std::string prompt = args(0).string_value ("input: unrecognized argument");
 
   flush_octave_stdout ();
 
@@ -837,15 +831,7 @@
       std::string prompt;
 
       if (nargin == 1)
-        {
-          if (args(0).is_string ())
-            prompt = args(0).string_value ();
-          else
-            {
-              error ("yes_or_no: PROMPT must be a string");
-              return retval;
-            }
-        }
+        prompt = args(0).string_value ("yes_or_no: PROMPT must be a string");
 
       retval = octave_yes_or_no (prompt);
     }