diff libinterp/corefcn/psi.cc @ 20704:571508c1ed06

eliminate more uses of error_state * ov.h, ov.cc (octave_value::xall_strings): New extractor. * bitfcns.cc, data.cc, ellipj.cc, fftn.cc, file-io.cc, filter.cc, find.cc, graphics.cc, input.cc, load-path.cc, luinc.cc, matrix_type.cc, oct-stream.cc, ordschur.cc, psi.cc, rand.cc, spparms.cc, strfns.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc, utils.cc, variables.cc, __glpk__.cc, __magick_read__.cc, amd.cc, ov-cell.cc, ov-fcn-inline.cc, ov-struct.cc: Eliminate more uses of error_state. * system.tst: Update tests.
author John W. Eaton <jwe@octave.org>
date Sat, 14 Nov 2015 15:18:05 -0500
parents 099bdf98f724
children a542a9bf177e
line wrap: on
line diff
--- a/libinterp/corefcn/psi.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/psi.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -75,10 +75,10 @@
     }
 
   const octave_value oct_z = (nargin == 1) ? args(0) : args(1);
-  const octave_idx_type k = (nargin == 1) ? 0 : args(0).idx_type_value ();
-  if (error_state || k < 0)
+  const octave_idx_type k = (nargin == 1) ? 0 : args(0).idx_type_value ("psi: K must be an integer");
+  if (k < 0)
     {
-      error ("psi: K must be a non-negative integer");
+      error ("psi: K must be non-negative");
       return retval;
     }
   else if (k == 0)
@@ -232,7 +232,8 @@
 %!error psi ()
 %!error psi (1, 2, 3)
 %!error <Z must be> psi ("non numeric")
-%!error <K must be a non-negative integer> psi (-5, 1)
+%!error <conversion of 5.3 to int value failed> psi (5.3, 1)
+%!error <K must be non-negative> psi (-5, 1)
 %!error <Z must be non-negative for polygamma> psi (5, -1)
 %!error <Z must be a floating point> psi (5, uint8 (-1))
 %!error <Z must be real value for polygamma> psi (5, 5i)