diff libinterp/dldfcn/chol.cc @ 20614:10ec79b47808

use new string_value method to handle value extraction errors * __voronoi__.cc, chol.cc, colamd.cc, fftw.cc: Use new string_value method.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Oct 2015 18:15:56 -0400
parents 0650b8431037
children
line wrap: on
line diff
--- a/libinterp/dldfcn/chol.cc	Thu Oct 08 17:41:21 2015 -0400
+++ b/libinterp/dldfcn/chol.cc	Thu Oct 08 18:15:56 2015 -0400
@@ -162,21 +162,16 @@
   int n = 1;
   while (n < nargin)
     {
-      std::string tmp = args(n++).string_value ();
+      std::string tmp = args(n++).string_value ("chol: expecting trailing string arguments");
 
-      if (! error_state)
-        {
-          if (tmp.compare ("vector") == 0)
-            vecout = true;
-          else if (tmp.compare ("lower") == 0)
-            LLt = true;
-          else if (tmp.compare ("upper") == 0)
-            LLt = false;
-          else
-            error ("chol: unexpected second or third input");
-        }
+      if (tmp.compare ("vector") == 0)
+        vecout = true;
+      else if (tmp.compare ("lower") == 0)
+        LLt = true;
+      else if (tmp.compare ("upper") == 0)
+        LLt = false;
       else
-        error ("chol: expecting trailing string arguments");
+        error ("chol: unexpected second or third input");
     }
 
   octave_value arg = args(0);
@@ -350,7 +345,8 @@
 %!error chol ()
 %!error <matrix must be positive definite> chol ([1, 2; 3, 4])
 %!error <requires square matrix> chol ([1, 2; 3, 4; 5, 6])
-%!error <unexpected second or third input> chol (1, 2)
+%!error <expecting trailing string arguments> chol (1, 2)
+%!error <unexpected second or third input> chol (1, "foobar")
 */
 
 DEFUN_DLD (cholinv, args, ,