changeset 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 85e5efae848a
children 632683d6396f
files libinterp/corefcn/bitfcns.cc libinterp/corefcn/data.cc libinterp/corefcn/ellipj.cc libinterp/corefcn/fftn.cc libinterp/corefcn/file-io.cc libinterp/corefcn/filter.cc libinterp/corefcn/find.cc libinterp/corefcn/graphics.cc libinterp/corefcn/input.cc libinterp/corefcn/load-path.cc libinterp/corefcn/luinc.cc libinterp/corefcn/matrix_type.cc libinterp/corefcn/oct-stream.cc libinterp/corefcn/ordschur.cc libinterp/corefcn/psi.cc libinterp/corefcn/rand.cc libinterp/corefcn/spparms.cc libinterp/corefcn/strfns.cc libinterp/corefcn/symtab.cc libinterp/corefcn/syscalls.cc libinterp/corefcn/sysdep.cc libinterp/corefcn/time.cc libinterp/corefcn/utils.cc libinterp/corefcn/variables.cc libinterp/dldfcn/__glpk__.cc libinterp/dldfcn/__magick_read__.cc libinterp/dldfcn/amd.cc libinterp/octave-value/ov-cell.cc libinterp/octave-value/ov-fcn-inline.cc libinterp/octave-value/ov-struct.cc libinterp/octave-value/ov.cc libinterp/octave-value/ov.h test/system.tst
diffstat 33 files changed, 1054 insertions(+), 1590 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/bitfcns.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/bitfcns.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -574,27 +574,20 @@
     {
       int nbits = 64;
 
-      NDArray n = args(1).array_value ();
+      NDArray n = args(1).xarray_value ("bitshift: expecting integer as second argument");
 
-      if (error_state)
-        error ("bitshift: expecting integer as second argument");
-      else
+      if (nargin == 3)
         {
-          if (nargin == 3)
+          // FIXME: for compatibility, we should accept an array
+          // or a scalar as the third argument.
+          if (args(2).numel () > 1)
+            error ("bitshift: N must be a scalar integer");
+          else
             {
-              // FIXME: for compatibility, we should accept an array
-              // or a scalar as the third argument.
-              if (args(2).numel () > 1)
-                error ("bitshift: N must be a scalar integer");
-              else
-                {
-                  nbits = args(2).int_value ();
+              nbits = args(2).xint_value ("bitshift: N must be an integer");
 
-                  if (error_state)
-                    error ("bitshift: N must be an integer");
-                  else if (nbits < 0)
-                    error ("bitshift: N must be positive");
-                }
+              if (nbits < 0)
+                error ("bitshift: N must be positive");
             }
         }
 
--- a/libinterp/corefcn/data.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/data.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -96,17 +96,12 @@
  \
   if (nargin == 1 || nargin == 2) \
     { \
-      int dim = (nargin == 1 ? -1 : args(1).int_value (true) - 1); \
+      int dim = (nargin == 1 ? -1 : args(1).int_value (#FCN ": expecting dimension argument to be an integer") - 1); \
  \
-      if (! error_state) \
-        { \
-          if (dim >= -1) \
-            retval = args(0).FCN (dim); \
-          else \
-            error (#FCN ": invalid dimension argument = %d", dim + 1); \
-        } \
+      if (dim >= -1) \
+        retval = args(0).FCN (dim); \
       else \
-        error (#FCN ": expecting dimension argument to be an integer"); \
+        error (#FCN ": invalid dimension argument = %d", dim + 1); \
     } \
   else \
     print_usage (); \
@@ -1384,12 +1379,9 @@
     retval = args(0).diag ();
   else if (nargin == 2 && args(0).is_defined () && args(1).is_defined ())
     {
-      octave_idx_type k = args(1).int_value ();
-
-      if (error_state)
-        error ("diag: invalid argument K");
-      else
-        retval = args(0).diag (k);
+      octave_idx_type k = args(1).xint_value ("diag: invalid argument K");
+
+      retval = args(0).diag (k);
     }
   else if (nargin == 3)
     {
@@ -1397,13 +1389,10 @@
 
       if (arg0.ndims () == 2 && (arg0.rows () == 1 || arg0.columns () == 1))
         {
-          octave_idx_type m = args(1).int_value ();
-          octave_idx_type n = args(2).int_value ();
-
-          if (! error_state)
-            retval = arg0.diag (m, n);
-          else
-            error ("diag: invalid dimensions");
+          octave_idx_type m = args(1).xint_value ("diag: invalid dimensions");
+          octave_idx_type n = args(2).xint_value ("diag: invalid dimensions");
+
+          retval = arg0.diag (m, n);
         }
       else
         error ("diag: V must be a vector");
@@ -2405,17 +2394,12 @@
 
   if (args.length () > 0)
     {
-      int dim = args(0).int_value () - 1;
-
-      if (! error_state)
-        {
-          if (dim >= 0)
-            retval = do_cat (args.slice (1, args.length () - 1), dim, "cat");
-          else
-            error ("cat: DIM must be a valid dimension");
-        }
+      int dim = args(0).xint_value ("cat: DIM must be an integer") - 1;
+
+      if (dim >= 0)
+        retval = do_cat (args.slice (1, args.length () - 1), dim, "cat");
       else
-        error ("cat: DIM must be an integer");
+        error ("cat: DIM must be a valid dimension");
     }
   else
     print_usage ();
@@ -2820,24 +2804,19 @@
     }
   else if (nargin == 2 && nargout < 2)
     {
-      octave_idx_type nd = args(1).int_value (true);
-
-      if (error_state)
-        error ("size: DIM must be a scalar");
-      else
+      octave_idx_type nd = args(1).xint_value ("size: DIM must be an integer");
+
+      const dim_vector dv = args(0).dims ();
+
+      if (nd > 0)
         {
-          const dim_vector dv = args(0).dims ();
-
-          if (nd > 0)
-            {
-              if (nd <= dv.length ())
-                retval(0) = dv(nd-1);
-              else
-                retval(0) = 1;
-            }
+          if (nd <= dv.length ())
+            retval(0) = dv(nd-1);
           else
-            error ("size: requested dimension DIM (= %d) out of range", nd);
+            retval(0) = 1;
         }
+      else
+        error ("size: requested dimension DIM (= %d) out of range", nd);
     }
   else
     print_usage ();
@@ -3347,7 +3326,7 @@
         {
           if (arg.is_sparse_type ())
             {
-              SparseComplexMatrix val = arg.sparse_complex_matrix_value ();
+              SparseComplexMatrix val = arg.xsparse_complex_matrix_value ("complex: invalid conversion");
 
               retval = octave_value (new octave_sparse_complex_matrix (val));
             }
@@ -3355,13 +3334,13 @@
             {
               if (arg.numel () == 1)
                 {
-                  FloatComplex val = arg.float_complex_value ();
+                  FloatComplex val = arg.xfloat_complex_value ("complex: invalid conversion");
 
                   retval = octave_value (new octave_float_complex (val));
                 }
               else
                 {
-                  FloatComplexNDArray val = arg.float_complex_array_value ();
+                  FloatComplexNDArray val = arg.xfloat_complex_array_value ("complex: invalid conversion");
 
                   retval = octave_value (new octave_float_complex_matrix (val));
                 }
@@ -3370,20 +3349,17 @@
             {
               if (arg.numel () == 1)
                 {
-                  Complex val = arg.complex_value ();
+                  Complex val = arg.xcomplex_value ("complex: invalid conversion");
 
                   retval = octave_value (new octave_complex (val));
                 }
               else
                 {
-                  ComplexNDArray val = arg.complex_array_value ();
+                  ComplexNDArray val = arg.xcomplex_array_value ("complex: invalid conversion");
 
                   retval = octave_value (new octave_complex_matrix (val));
                 }
             }
-
-          if (error_state)
-            error ("complex: invalid conversion");
         }
     }
   else if (nargin == 2)
@@ -3576,9 +3552,6 @@
                 error ("complex: dimension mismatch");
             }
         }
-
-      if (error_state)
-        error ("complex: invalid conversion");
     }
   else
     print_usage ();
@@ -3965,15 +3938,8 @@
         dims.resize (nargin);
 
         for (int i = 0; i < nargin; i++)
-          {
-            dims(i) = args(i).is_empty () ? 0 : args(i).idx_type_value ();
-
-            if (error_state)
-              {
-                error ("%s: expecting scalar integer arguments", fcn);
-                break;
-              }
-          }
+          dims(i) = (args(i).is_empty ()
+                     ? 0 : args(i).xidx_type_value ("%s: expecting scalar integer arguments", fcn));
       }
       break;
     }
@@ -4082,15 +4048,8 @@
         dims.resize (nargin);
 
         for (int i = 0; i < nargin; i++)
-          {
-            dims(i) = args(i).is_empty () ? 0 : args(i).idx_type_value ();
-
-            if (error_state)
-              {
-                error ("%s: expecting scalar integer arguments", fcn);
-                break;
-              }
-          }
+          dims(i) = (args(i).is_empty ()
+                     ? 0 : args(i).xidx_type_value ("%s: expecting scalar integer arguments", fcn));
       }
       break;
     }
@@ -4153,15 +4112,8 @@
         dims.resize (nargin);
 
         for (int i = 0; i < nargin; i++)
-          {
-            dims(i) = args(i).is_empty () ? 0 : args(i).idx_type_value ();
-
-            if (error_state)
-              {
-                error ("%s: expecting scalar integer arguments", fcn);
-                break;
-              }
-          }
+          dims(i) = (args(i).is_empty ()
+                     ? 0 : args(i).xidx_type_value ("%s: expecting scalar integer arguments", fcn));
       }
       break;
     }
@@ -4225,15 +4177,8 @@
         dims.resize (nargin);
 
         for (int i = 0; i < nargin; i++)
-          {
-            dims(i) = args(i).is_empty () ? 0 : args(i).idx_type_value ();
-
-            if (error_state)
-              {
-                error ("%s: expecting scalar integer arguments", fcn);
-                break;
-              }
-          }
+          dims(i) = (args(i).is_empty ()
+                     ? 0 : args(i).xidx_type_value ("%s: expecting scalar integer arguments", fcn));
       }
       break;
     }
@@ -4287,15 +4232,8 @@
         dims.resize (nargin);
 
         for (int i = 0; i < nargin; i++)
-          {
-            dims(i) = args(i).is_empty () ? 0 : args(i).idx_type_value ();
-
-            if (error_state)
-              {
-                error ("%s: expecting scalar integer arguments", fcn);
-                break;
-              }
-          }
+          dims(i) = (args(i).is_empty ()
+                     ? 0 : args(i).xidx_type_value ("%s: expecting scalar integer arguments", fcn));
       }
       break;
     }
@@ -6433,22 +6371,17 @@
     {
       if (nargin == 1)
         {
-          octave_uint64 id = args(0).uint64_scalar_value ();
-
-          if (! error_state)
-            {
-              uint64_t val = id.value ();
-
-              start_time
-                = (static_cast<double> (val / CLOCKS_PER_SEC)
-                   + static_cast<double> (val % CLOCKS_PER_SEC)
-                   / CLOCKS_PER_SEC);
-
-              // FIXME: should we also check to see whether the start
-              // time is after the beginning of this Octave session?
-            }
-          else
-            error ("toc: invalid ID");
+          octave_uint64 id = args(0).xuint64_scalar_value ("toc: invalid ID");
+
+          uint64_t val = id.value ();
+
+          start_time
+            = (static_cast<double> (val / CLOCKS_PER_SEC)
+               + static_cast<double> (val % CLOCKS_PER_SEC)
+               / CLOCKS_PER_SEC);
+
+          // FIXME: should we also check to see whether the start
+          // time is after the beginning of this Octave session?
         }
 
       if (start_time < 0)
--- a/libinterp/corefcn/ellipj.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/ellipj.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -28,12 +28,6 @@
 #include "error.h"
 #include "lo-specfun.h"
 
-static void
-gripe_ellipj_arg (const char *arg)
-{
-  error ("ellipj: expecting scalar or matrix as %s argument", arg);
-}
-
 DEFUN (ellipj, args, nargout,
        "-*- texinfo -*-\n\
 @deftypefn  {Built-in Function} {[@var{sn}, @var{cn}, @var{dn}, @var{err}] =} ellipj (@var{u}, @var{m})\n\
@@ -89,26 +83,14 @@
 
   if (m_arg.is_scalar_type ())
     {
-      double m = args(1).double_value ();
-
-      if (error_state)
-        {
-          gripe_ellipj_arg ("second");
-          return retval;
-        }
+      double m = args(1).xdouble_value ("ellipj: expecting scalar or matrix as second argument");
 
       if (u_arg.is_scalar_type ())
         {
           if (u_arg.is_real_type ())
             {
               // u real, m scalar
-              double u = args(0).double_value ();
-
-              if (error_state)
-                {
-                  gripe_ellipj_arg ("first");
-                  return retval;
-                }
+              double u = args(0).xdouble_value ("ellipj: expecting scalar or matrix as first argument");
 
               double sn, cn, dn;
               double err = 0;
@@ -124,13 +106,7 @@
           else
             {
               // u complex, m scalar
-              Complex u = u_arg.complex_value ();
-
-              if (error_state)
-                {
-                  gripe_ellipj_arg ("first");
-                  return retval;
-                }
+              Complex u = u_arg.xcomplex_value ("ellipj: expecting scalar or matrix as first argument");
 
               Complex sn, cn, dn;
               double err = 0;
@@ -147,13 +123,7 @@
       else
         {
           // u is matrix, m is scalar
-          ComplexNDArray u = u_arg.complex_array_value ();
-
-          if (error_state)
-            {
-              gripe_ellipj_arg ("first");
-              return retval;
-            }
+          ComplexNDArray u = u_arg.xcomplex_array_value ("ellipj: expecting scalar or matrix as first argument");
 
           dim_vector sz_u = u.dims ();
 
@@ -179,13 +149,7 @@
     }
   else
     {
-      NDArray m = args(1).array_value ();
-
-      if (error_state)
-        {
-          gripe_ellipj_arg ("second");
-          return retval;
-        }
+      NDArray m = args(1).xarray_value ("ellipj: expecting scalar or matrix as second argument");
 
       dim_vector sz_m = m.dims ();
 
@@ -195,13 +159,7 @@
           if (u_arg.is_real_type ())
             {
               // u is real scalar, m is array
-              double u = u_arg.double_value ();
-
-              if (error_state)
-                {
-                  gripe_ellipj_arg ("first");
-                  return retval;
-                }
+              double u = u_arg.xdouble_value ("ellipj: expecting scalar or matrix as first argument");
 
               NDArray sn (sz_m), cn (sz_m), dn (sz_m);
               NDArray err (sz_m);
@@ -225,13 +183,7 @@
           else
             {
               // u is complex scalar, m is array
-              Complex u = u_arg.complex_value ();
-
-              if (error_state)
-                {
-                  gripe_ellipj_arg ("first");
-                  return retval;
-                }
+              Complex u = u_arg.xcomplex_value ("ellipj: expecting scalar or matrix as first argument");
 
               ComplexNDArray sn (sz_m), cn (sz_m), dn (sz_m);
               NDArray err (sz_m);
@@ -259,13 +211,7 @@
           if (u_arg.is_real_type ())
             {
               // u is real array, m is array
-              NDArray u = u_arg.array_value ();
-
-              if (error_state)
-                {
-                  gripe_ellipj_arg ("first");
-                  return retval;
-                }
+              NDArray u = u_arg.xarray_value ("ellipj: expecting scalar or matrix as first argument");
 
               dim_vector sz_u = u.dims ();
 
@@ -322,13 +268,7 @@
           else
             {
               // u is complex array, m is array
-              ComplexNDArray u = u_arg.complex_array_value ();
-
-              if (error_state)
-                {
-                  gripe_ellipj_arg ("second");
-                  return retval;
-                }
+              ComplexNDArray u = u_arg.xcomplex_array_value ("ellipj: expecting scalar or matrix as second argument");
 
               dim_vector sz_u = u.dims ();
 
--- a/libinterp/corefcn/fftn.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/fftn.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -62,11 +62,12 @@
 
   if (nargin > 1)
     {
-      Matrix val = args(1).matrix_value ();
+      Matrix val = args(1).xmatrix_value ("%s: SIZE must be a vector of length dim", fcn);
+
       if (val.rows () > val.columns ())
         val = val.transpose ();
 
-      if (error_state || val.columns () != dims.length () || val.rows () != 1)
+      if (val.columns () != dims.length () || val.rows () != 1)
         error ("%s: SIZE must be a vector of length dim", fcn);
       else
         {
--- a/libinterp/corefcn/file-io.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/file-io.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -2123,26 +2123,18 @@
 
   if (args.length () == 1)
     {
-      int mask = args(0).int_value (true);
+      int mask = args(0).xint_value ("umask: MASK must be an integer");
 
-      if (! error_state)
+      if (mask < 0)
         {
-          if (mask < 0)
-            {
-              status = -1;
-              error ("umask: MASK must be a positive integer value");
-            }
-          else
-            {
-              int oct_mask = convert (mask, 8, 10);
-
-              status = convert (octave_umask (oct_mask), 10, 8);
-            }
+          status = -1;
+          error ("umask: MASK must be a positive integer value");
         }
       else
         {
-          status = -1;
-          error ("umask: MASK must be an integer");
+          int oct_mask = convert (mask, 8, 10);
+
+          status = convert (octave_umask (oct_mask), 10, 8);
         }
     }
   else
--- a/libinterp/corefcn/filter.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/filter.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -402,7 +402,8 @@
       return retval;
     }
 
-  const char *errmsg = "filter: arguments a and b must be vectors";
+  const char *a_b_errmsg = "filter: A and B must be vectors";
+  const char *x_si_errmsg = "filter: X and SI must be arrays";
 
   int dim;
   dim_vector x_dims = args(2).dims ();
@@ -440,198 +441,157 @@
     {
       if (isfloat)
         {
-          FloatComplexColumnVector b (args(0).float_complex_vector_value ());
-          FloatComplexColumnVector a (args(1).float_complex_vector_value ());
-
-          FloatComplexNDArray x (args(2).float_complex_array_value ());
-
-          if (! error_state)
-            {
-              FloatComplexNDArray si;
+          FloatComplexColumnVector b = args(0).xfloat_complex_vector_value (a_b_errmsg);
+          FloatComplexColumnVector a = args(1).xfloat_complex_vector_value (a_b_errmsg);
+          FloatComplexNDArray x = args(2).xfloat_complex_array_value (x_si_errmsg);
 
-              if (nargin == 3 || args(3).is_empty ())
-                {
-                  octave_idx_type a_len = a.numel ();
-                  octave_idx_type b_len = b.numel ();
-
-                  octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
-
-                  dim_vector si_dims = x.dims ();
-                  for (int i = dim; i > 0; i--)
-                    si_dims(i) = si_dims(i-1);
-                  si_dims(0) = si_len;
+          FloatComplexNDArray si;
 
-                  si.resize (si_dims, 0.0);
-                }
-              else
-                {
-                  si = args(3).float_complex_array_value ();
+          if (nargin == 3 || args(3).is_empty ())
+            {
+              octave_idx_type a_len = a.numel ();
+              octave_idx_type b_len = b.numel ();
 
-                  if (si.is_vector () && x.is_vector ())
-                    si = si.reshape (dim_vector (si.numel (), 1));
-                }
+              octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
-              if (! error_state)
-                {
-                  FloatComplexNDArray y (filter (b, a, x, si, dim));
+              dim_vector si_dims = x.dims ();
+              for (int i = dim; i > 0; i--)
+                si_dims(i) = si_dims(i-1);
+              si_dims(0) = si_len;
 
-                  if (nargout == 2)
-                    retval(1) = si;
-
-                  retval(0) = y;
-                }
-              else
-                error (errmsg);
+              si.resize (si_dims, 0.0);
             }
           else
-            error (errmsg);
+            {
+              si = args(3).xfloat_complex_array_value (x_si_errmsg);
+
+              if (si.is_vector () && x.is_vector ())
+                si = si.reshape (dim_vector (si.numel (), 1));
+            }
+
+          FloatComplexNDArray y (filter (b, a, x, si, dim));
+
+          if (nargout == 2)
+            retval(1) = si;
+
+          retval(0) = y;
         }
       else
         {
-          ComplexColumnVector b (args(0).complex_vector_value ());
-          ComplexColumnVector a (args(1).complex_vector_value ());
-
-          ComplexNDArray x (args(2).complex_array_value ());
-
-          if (! error_state)
-            {
-              ComplexNDArray si;
+          ComplexColumnVector b = args(0).xcomplex_vector_value (a_b_errmsg);
+          ComplexColumnVector a = args(1).xcomplex_vector_value (a_b_errmsg);
 
-              if (nargin == 3 || args(3).is_empty ())
-                {
-                  octave_idx_type a_len = a.numel ();
-                  octave_idx_type b_len = b.numel ();
+          ComplexNDArray x = args(2).xcomplex_array_value (x_si_errmsg);
 
-                  octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
-
-                  dim_vector si_dims = x.dims ();
-                  for (int i = dim; i > 0; i--)
-                    si_dims(i) = si_dims(i-1);
-                  si_dims(0) = si_len;
+          ComplexNDArray si;
 
-                  si.resize (si_dims, 0.0);
-                }
-              else
-                {
-                  si = args(3).complex_array_value ();
+          if (nargin == 3 || args(3).is_empty ())
+            {
+              octave_idx_type a_len = a.numel ();
+              octave_idx_type b_len = b.numel ();
 
-                  if (si.is_vector () && x.is_vector ())
-                    si = si.reshape (dim_vector (si.numel (), 1));
-                }
+              octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
-              if (! error_state)
-                {
-                  ComplexNDArray y (filter (b, a, x, si, dim));
+              dim_vector si_dims = x.dims ();
+              for (int i = dim; i > 0; i--)
+                si_dims(i) = si_dims(i-1);
+              si_dims(0) = si_len;
 
-                  if (nargout == 2)
-                    retval(1) = si;
-
-                  retval(0) = y;
-                }
-              else
-                error (errmsg);
+              si.resize (si_dims, 0.0);
             }
           else
-            error (errmsg);
+            {
+              si = args(3).xcomplex_array_value (x_si_errmsg);
+
+              if (si.is_vector () && x.is_vector ())
+                si = si.reshape (dim_vector (si.numel (), 1));
+            }
+
+          ComplexNDArray y (filter (b, a, x, si, dim));
+
+          if (nargout == 2)
+            retval(1) = si;
+
+          retval(0) = y;
         }
     }
   else
     {
       if (isfloat)
         {
-          FloatColumnVector b (args(0).float_vector_value ());
-          FloatColumnVector a (args(1).float_vector_value ());
-
-          FloatNDArray x (args(2).float_array_value ());
-
-          if (! error_state)
-            {
-              FloatNDArray si;
+          FloatColumnVector b = args(0).xfloat_vector_value (a_b_errmsg);
+          FloatColumnVector a = args(1).xfloat_vector_value (a_b_errmsg);
 
-              if (nargin == 3 || args(3).is_empty ())
-                {
-                  octave_idx_type a_len = a.numel ();
-                  octave_idx_type b_len = b.numel ();
+          FloatNDArray x = args(2).xfloat_array_value (x_si_errmsg);
 
-                  octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
-
-                  dim_vector si_dims = x.dims ();
-                  for (int i = dim; i > 0; i--)
-                    si_dims(i) = si_dims(i-1);
-                  si_dims(0) = si_len;
+          FloatNDArray si;
 
-                  si.resize (si_dims, 0.0);
-                }
-              else
-                {
-                  si = args(3).float_array_value ();
+          if (nargin == 3 || args(3).is_empty ())
+            {
+              octave_idx_type a_len = a.numel ();
+              octave_idx_type b_len = b.numel ();
 
-                  if (si.is_vector () && x.is_vector ())
-                    si = si.reshape (dim_vector (si.numel (), 1));
-                }
+              octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
-              if (! error_state)
-                {
-                  FloatNDArray y (filter (b, a, x, si, dim));
+              dim_vector si_dims = x.dims ();
+              for (int i = dim; i > 0; i--)
+                si_dims(i) = si_dims(i-1);
+              si_dims(0) = si_len;
 
-                  if (nargout == 2)
-                    retval(1) = si;
-
-                  retval(0) = y;
-                }
-              else
-                error (errmsg);
+              si.resize (si_dims, 0.0);
             }
           else
-            error (errmsg);
+            {
+              si = args(3).xfloat_array_value (x_si_errmsg);
+
+              if (si.is_vector () && x.is_vector ())
+                si = si.reshape (dim_vector (si.numel (), 1));
+            }
+
+          FloatNDArray y (filter (b, a, x, si, dim));
+
+          if (nargout == 2)
+            retval(1) = si;
+
+          retval(0) = y;
         }
       else
         {
-          ColumnVector b (args(0).vector_value ());
-          ColumnVector a (args(1).vector_value ());
-
-          NDArray x (args(2).array_value ());
-
-          if (! error_state)
-            {
-              NDArray si;
+          ColumnVector b = args(0).xvector_value (a_b_errmsg);
+          ColumnVector a = args(1).xvector_value (a_b_errmsg);
 
-              if (nargin == 3 || args(3).is_empty ())
-                {
-                  octave_idx_type a_len = a.numel ();
-                  octave_idx_type b_len = b.numel ();
+          NDArray x = args(2).xarray_value (x_si_errmsg);
 
-                  octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
-
-                  dim_vector si_dims = x.dims ();
-                  for (int i = dim; i > 0; i--)
-                    si_dims(i) = si_dims(i-1);
-                  si_dims(0) = si_len;
+          NDArray si;
 
-                  si.resize (si_dims, 0.0);
-                }
-              else
-                {
-                  si = args(3).array_value ();
+          if (nargin == 3 || args(3).is_empty ())
+            {
+              octave_idx_type a_len = a.numel ();
+              octave_idx_type b_len = b.numel ();
 
-                  if (si.is_vector () && x.is_vector ())
-                    si = si.reshape (dim_vector (si.numel (), 1));
-                }
+              octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1;
 
-              if (! error_state)
-                {
-                  NDArray y (filter (b, a, x, si, dim));
+              dim_vector si_dims = x.dims ();
+              for (int i = dim; i > 0; i--)
+                si_dims(i) = si_dims(i-1);
+              si_dims(0) = si_len;
 
-                  if (nargout == 2)
-                    retval(1) = si;
-
-                  retval(0) = y;
-                }
-              else
-                error (errmsg);
+              si.resize (si_dims, 0.0);
             }
           else
-            error (errmsg);
+            {
+              si = args(3).xarray_value (x_si_errmsg);
+
+              if (si.is_vector () && x.is_vector ())
+                si = si.reshape (dim_vector (si.numel (), 1));
+            }
+
+          NDArray y (filter (b, a, x, si, dim));
+
+          if (nargout == 2)
+            retval(1) = si;
+
+          retval(0) = y;
         }
     }
 
--- a/libinterp/corefcn/find.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/find.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -405,13 +405,10 @@
   octave_idx_type n_to_find = -1;
   if (nargin > 1)
     {
-      double val = args(1).scalar_value ();
+      double val = args(1).xscalar_value ("find: N must be an integer");
 
-      if (error_state || (val < 0 || (! xisinf (val) && val != xround (val))))
-        {
-          error ("find: N must be a non-negative integer");
-          return retval;
-        }
+      if (val < 0 || (! xisinf (val) && val != xround (val)))
+        error ("find: N must be a non-negative integer");
       else if (! xisinf (val))
         n_to_find = val;
     }
--- a/libinterp/corefcn/graphics.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/graphics.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -1513,27 +1513,22 @@
         return false;
     }
 
-  double dv = v.double_value ();
-
-  if (! error_state)
-    {
-      graphics_handle gh = gh_manager::lookup (dv);
-
-      if (xisnan (gh.value ()) || gh.ok ())
-        {
-          if (current_val != gh)
-            {
-              current_val = gh;
-              return true;
-            }
-        }
-      else
-        error ("set: invalid graphics handle (= %g) for property \"%s\"",
-               dv, get_name ().c_str ());
-    }
-  else
-    error ("set: invalid graphics handle for property \"%s\"",
-           get_name ().c_str ());
+  double dv = v.xdouble_value ("set: invalid graphics handle for property \"%s\"",
+                              get_name ().c_str ());
+
+  graphics_handle gh = gh_manager::lookup (dv);
+
+  if (xisnan (gh.value ()) || gh.ok ())
+    {
+      if (current_val != gh)
+        {
+          current_val = gh;
+          return true;
+        }
+    }
+  else
+    error ("set: invalid graphics handle (= %g) for property \"%s\"",
+           dv, get_name ().c_str ());
 
   return false;
 }
@@ -2557,34 +2552,29 @@
 {
   graphics_handle h = octave_NaN;
 
-  double hv = ov.double_value ();
-
-  if (! error_state)
-    {
-      h = gh_manager::lookup (hv);
-
-      if (h.ok ())
-        {
-          graphics_object go = gh_manager::get_object (h);
-
-          graphics_handle parent_h = go.get_parent ();
-
-          graphics_object parent_go = gh_manager::get_object (parent_h);
-
-          parent_go.remove_child (h);
-
-          if (adopt)
-            go.set ("parent", new_parent.value ());
-          else
-            go.reparent (new_parent);
-        }
+  double hv = ov.xdouble_value ("%s: expecting %s to be a graphics handle",
+                               who.c_str (), pname.c_str ());
+
+  h = gh_manager::lookup (hv);
+
+  if (h.ok ())
+    {
+      graphics_object go = gh_manager::get_object (h);
+
+      graphics_handle parent_h = go.get_parent ();
+
+      graphics_object parent_go = gh_manager::get_object (parent_h);
+
+      parent_go.remove_child (h);
+
+      if (adopt)
+        go.set ("parent", new_parent.value ());
       else
-        error ("%s: invalid graphics handle (= %g) for %s",
-               who.c_str (), hv, pname.c_str ());
-    }
-  else
-    error ("%s: expecting %s to be a graphics handle",
-           who.c_str (), pname.c_str ());
+        go.reparent (new_parent);
+    }
+  else
+    error ("%s: invalid graphics handle (= %g) for %s",
+           who.c_str (), hv, pname.c_str ());
 
   return h;
 }
@@ -2975,48 +2965,43 @@
 void
 base_properties::set_parent (const octave_value& val)
 {
-  double hp = val.double_value ();
+  double hp = val.xdouble_value ("set: expecting parent to be a graphics handle");
 
   graphics_handle new_parent = octave_NaN;
 
-  if (! error_state)
-    {
-      if (hp == __myhandle__)
-        error ("set: can not set object parent to be object itself");
+  if (hp == __myhandle__)
+    error ("set: can not set object parent to be object itself");
+  else
+    {
+      new_parent = gh_manager::lookup (hp);
+
+      if (new_parent.ok ())
+        {
+          // Remove child from current parent
+          graphics_object old_parent_go;
+          old_parent_go = gh_manager::get_object (get_parent ());
+
+          if (old_parent_go.get_handle () != hp)
+            old_parent_go.remove_child (__myhandle__);
+          else
+            return;  // Do nothing more
+
+          // Check new parent's parent is not this child to avoid recursion
+          graphics_object new_parent_go;
+          new_parent_go = gh_manager::get_object (new_parent);
+          if (new_parent_go.get_parent () == __myhandle__)
+            {
+              // new parent's parent gets child's original parent
+              new_parent_go.get_properties ().set_parent (get_parent ().as_octave_value ());
+            }
+
+          // Set parent property to new_parent and do adoption
+          parent = new_parent.as_octave_value ();
+          ::adopt (parent.handle_value (), __myhandle__);
+        }
       else
-        {
-          new_parent = gh_manager::lookup (hp);
-
-          if (new_parent.ok ())
-            {
-              // Remove child from current parent
-              graphics_object old_parent_go;
-              old_parent_go = gh_manager::get_object (get_parent ());
-
-              if (old_parent_go.get_handle () != hp)
-                old_parent_go.remove_child (__myhandle__);
-              else
-                return;  // Do nothing more
-
-              // Check new parent's parent is not this child to avoid recursion
-              graphics_object new_parent_go;
-              new_parent_go = gh_manager::get_object (new_parent);
-              if (new_parent_go.get_parent () == __myhandle__)
-                {
-                  // new parent's parent gets child's original parent
-                  new_parent_go.get_properties ().set_parent (get_parent ().as_octave_value ());
-                }
-
-              // Set parent property to new_parent and do adoption
-              parent = new_parent.as_octave_value ();
-              ::adopt (parent.handle_value (), __myhandle__);
-            }
-          else
-            error ("set: invalid graphics handle (= %g) for parent", hp);
-        }
-    }
-  else
-    error ("set: expecting parent to be a graphics handle");
+        error ("set: invalid graphics handle (= %g) for parent", hp);
+    }
 }
 
 /*
@@ -10172,52 +10157,49 @@
   caseless_str p ("parent");
 
   for (int i = 0; i < xargs.length (); i++)
-    if (xargs(i).is_string () && p.compare (xargs(i).string_value ()))
-      {
-        if (i < (xargs.length () - 1))
-          {
-            val = xargs(i+1).double_value ();
-
-            xargs = xargs.splice (i, 2);
-            break;
-          }
-        else
-          error ("__go_%s__: missing value for parent property",
-                 go_name.c_str ());
-      }
+    {
+      if (xargs(i).is_string () && p.compare (xargs(i).string_value ()))
+        {
+          if (i < (xargs.length () - 1))
+            {
+              val = xargs(i+1).double_value ();
+
+              xargs = xargs.splice (i, 2);
+              break;
+            }
+          else
+            error ("__go_%s__: missing value for parent property",
+                   go_name.c_str ());
+        }
+    }
 
   if (xisnan (val))
-    val = args(0).double_value ();
-
-  if (! error_state)
-    {
-      graphics_handle parent = gh_manager::lookup (val);
-
-      if (parent.ok ())
-        {
-          graphics_handle h
-            = gh_manager::make_graphics_handle (go_name, parent,
-                                                integer_figure_handle,
-                                                false, false);
-
-          if (! error_state)
-            {
-              adopt (parent, h);
-
-              xset (h, xargs);
-              xcreatefcn (h);
-              xinitialize (h);
-
-              retval = h.value ();
-
-              Vdrawnow_requested = true;
-            }
-          else
-            error ("__go%s__: unable to create graphics handle",
-                   go_name.c_str ());
+    val = args(0).xdouble_value ("__go_%s__: invalid parent", go_name.c_str ());
+
+  graphics_handle parent = gh_manager::lookup (val);
+
+  if (parent.ok ())
+    {
+      graphics_handle h
+        = gh_manager::make_graphics_handle (go_name, parent,
+                                            integer_figure_handle,
+                                            false, false);
+
+      if (! error_state)
+        {
+          adopt (parent, h);
+
+          xset (h, xargs);
+          xcreatefcn (h);
+          xinitialize (h);
+
+          retval = h.value ();
+
+          Vdrawnow_requested = true;
         }
       else
-        error ("__go_%s__: invalid parent", go_name.c_str ());
+        error ("__go%s__: unable to create graphics handle",
+               go_name.c_str ());
     }
   else
     error ("__go_%s__: invalid parent", go_name.c_str ());
@@ -10237,83 +10219,78 @@
 
   if (args.length () > 0)
     {
-      double val = args(0).double_value ();
-
-      if (! error_state)
-        {
-          if (is_figure (val))
-            {
-              graphics_handle h = gh_manager::lookup (val);
-
-              xset (h, args.splice (0, 1));
+      double val = args(0).xdouble_value ("__go_figure__: expecting figure number to be double value");
+
+      if (is_figure (val))
+        {
+          graphics_handle h = gh_manager::lookup (val);
+
+          xset (h, args.splice (0, 1));
+
+          retval = h.value ();
+        }
+      else
+        {
+          bool int_fig_handle = true;
+
+          octave_value_list xargs = args.splice (0, 1);
+
+          graphics_handle h = octave_NaN;
+
+          if (xisnan (val))
+            {
+              caseless_str pname ("integerhandle");
+
+              for (int i = 0; i < xargs.length (); i++)
+                {
+                  if (xargs(i).is_string ()
+                      && pname.compare (xargs(i).string_value ()))
+                    {
+                      if (i < (xargs.length () - 1))
+                        {
+                          std::string pval = xargs(i+1).string_value ();
+
+                          caseless_str on ("on");
+                          int_fig_handle = on.compare (pval);
+                          xargs = xargs.splice (i, 2);
+
+                          break;
+                        }
+                    }
+                }
+
+              h = gh_manager::make_graphics_handle ("figure", 0,
+                                                    int_fig_handle,
+                                                    false, false);
+
+              if (! int_fig_handle)
+                {
+                  // We need to initialize the integerhandle property
+                  // without calling the set_integerhandle method,
+                  // because doing that will generate a new handle value...
+
+                  graphics_object go = gh_manager::get_object (h);
+                  go.get_properties ().init_integerhandle ("off");
+                }
+            }
+          else if (val > 0 && D_NINT (val) == val)
+            h = gh_manager::make_figure_handle (val, false);
+
+          if (! error_state && h.ok ())
+            {
+              adopt (0, h);
+
+              gh_manager::push_figure (h);
+
+              xset (h, xargs);
+              xcreatefcn (h);
+              xinitialize (h);
 
               retval = h.value ();
             }
           else
-            {
-              bool int_fig_handle = true;
-
-              octave_value_list xargs = args.splice (0, 1);
-
-              graphics_handle h = octave_NaN;
-
-              if (xisnan (val))
-                {
-                  caseless_str pname ("integerhandle");
-
-                  for (int i = 0; i < xargs.length (); i++)
-                    {
-                      if (xargs(i).is_string ()
-                          && pname.compare (xargs(i).string_value ()))
-                        {
-                          if (i < (xargs.length () - 1))
-                            {
-                              std::string pval = xargs(i+1).string_value ();
-
-                              caseless_str on ("on");
-                              int_fig_handle = on.compare (pval);
-                              xargs = xargs.splice (i, 2);
-
-                              break;
-                            }
-                        }
-                    }
-
-                  h = gh_manager::make_graphics_handle ("figure", 0,
-                                                        int_fig_handle,
-                                                        false, false);
-
-                  if (! int_fig_handle)
-                    {
-                      // We need to initialize the integerhandle property
-                      // without calling the set_integerhandle method,
-                      // because doing that will generate a new handle value...
-
-                      graphics_object go = gh_manager::get_object (h);
-                      go.get_properties ().init_integerhandle ("off");
-                    }
-                }
-              else if (val > 0 && D_NINT (val) == val)
-                h = gh_manager::make_figure_handle (val, false);
-
-              if (! error_state && h.ok ())
-                {
-                  adopt (0, h);
-
-                  gh_manager::push_figure (h);
-
-                  xset (h, xargs);
-                  xcreatefcn (h);
-                  xinitialize (h);
-
-                  retval = h.value ();
-                }
-              else
-                error ("__go_figure__: failed to create figure handle");
-            }
-        }
-      else
-        error ("__go_figure__: expecting figure number to be double value");
+            error ("__go_figure__: failed to create figure handle");
+        }
     }
   else
     print_usage ();
@@ -10383,11 +10360,9 @@
 
   if (nargin == 1)
     {
-      double h = args(0).double_value ();
-      if (! error_state)
-        retval = calc_dimensions (gh_manager::get_object (h));
-      else
-        error ("__calc_dimensions__: expecting graphics handle as only argument");
+      double h = args(0).xdouble_value ("__calc_dimensions__: expecting graphics handle as only argument");
+
+      retval = calc_dimensions (gh_manager::get_object (h));
     }
   else
     print_usage ();
@@ -10535,27 +10510,22 @@
     {
       graphics_handle h = octave_NaN;
 
-      const NDArray vals = args(0).array_value ();
-
-      if (! error_state)
-        {
-          // Check all the handles to delete are valid first, as callbacks
-          // might delete one of the handles we later want to delete
-          for (octave_idx_type i = 0; i < vals.numel (); i++)
-            {
-              h = gh_manager::lookup (vals(i));
-
-              if (! h.ok ())
-                {
-                  error ("delete: invalid graphics object (= %g)", vals(i));
-                  break;
-                }
-            }
-
-          delete_graphics_objects (vals);
-        }
-      else
-        error ("delete: invalid graphics object");
+      const NDArray vals = args(0).xarray_value ("delete: invalid graphics object");
+
+      // Check all the handles to delete are valid first, as callbacks
+      // might delete one of the handles we later want to delete
+      for (octave_idx_type i = 0; i < vals.numel (); i++)
+        {
+          h = gh_manager::lookup (vals(i));
+
+          if (! h.ok ())
+            {
+              error ("delete: invalid graphics object (= %g)", vals(i));
+              break;
+            }
+        }
+
+      delete_graphics_objects (vals);
     }
   else
     print_usage ();
@@ -10584,28 +10554,23 @@
     {
       graphics_handle h = octave_NaN;
 
-      double val = args(0).double_value ();
-
-      if (! error_state)
-        {
+      double val = args(0).xdouble_value ("__go_axes_init__: invalid graphics object");
+
+      h = gh_manager::lookup (val);
+
+      if (h.ok ())
+        {
+          graphics_object go = gh_manager::get_object (h);
+
+          go.set_defaults (mode);
+
           h = gh_manager::lookup (val);
-
-          if (h.ok ())
-            {
-              graphics_object go = gh_manager::get_object (h);
-
-              go.set_defaults (mode);
-
-              h = gh_manager::lookup (val);
-              if (! h.ok ())
-                error ("__go_axes_init__: axis deleted during initialization (= %g)",
-                       val);
-            }
-          else
-            error ("__go_axes_init__: invalid graphics object (= %g)", val);
+          if (! h.ok ())
+            error ("__go_axes_init__: axis deleted during initialization (= %g)",
+                   val);
         }
       else
-        error ("__go_axes_init__: invalid graphics object");
+        error ("__go_axes_init__: invalid graphics object (= %g)", val);
     }
   else
     print_usage ();
@@ -10658,27 +10623,22 @@
 
   if (nargin == 2 || nargin == 3)
     {
-      double val = args(0).double_value ();
-
-      if (! error_state)
-        {
-          graphics_handle h = gh_manager::lookup (val);
-
-          if (h.ok ())
-            {
-              std::string name = args(1).xstring_value ("__go_execute_callback__: invalid callback name");
-
-              if (nargin == 2)
-                gh_manager::execute_callback (h, name);
-              else
-                gh_manager::execute_callback (h, name, args(2));
-            }
+      double val = args(0).xdouble_value ("__go_execute_callback__: invalid graphics object");
+
+      graphics_handle h = gh_manager::lookup (val);
+
+      if (h.ok ())
+        {
+          std::string name = args(1).xstring_value ("__go_execute_callback__: invalid callback name");
+
+          if (nargin == 2)
+            gh_manager::execute_callback (h, name);
           else
-            error ("__go_execute_callback__: invalid graphics object (= %g)",
-                   val);
+            gh_manager::execute_callback (h, name, args(2));
         }
       else
-        error ("__go_execute_callback__: invalid graphics object");
+        error ("__go_execute_callback__: invalid graphics object (= %g)",
+               val);
     }
   else
     print_usage ();
@@ -10698,26 +10658,21 @@
 
   if (nargin == 1)
     {
-      double h = args(0).double_value ();
-
-      if (! error_state)
-        {
-          graphics_object go = gh_manager::get_object (h);
-          if (go && go.isa ("image"))
-            {
-              image::properties& ip =
-                dynamic_cast<image::properties&> (go.get_properties ());
-
-              Matrix dp = Matrix (1, 2);
-              dp(0) = ip.pixel_xsize ();
-              dp(1) = ip.pixel_ysize ();
-              retval = dp;
-            }
-          else
-            error ("__image_pixel_size__: object is not an image");
+      double h = args(0).xdouble_value ("__image_pixel_size__: argument is not a handle");
+
+      graphics_object go = gh_manager::get_object (h);
+      if (go && go.isa ("image"))
+        {
+          image::properties& ip =
+            dynamic_cast<image::properties&> (go.get_properties ());
+
+          Matrix dp = Matrix (1, 2);
+          dp(0) = ip.pixel_xsize ();
+          dp(1) = ip.pixel_ysize ();
+          retval = dp;
         }
       else
-        error ("__image_pixel_size__: argument is not a handle");
+        error ("__image_pixel_size__: object is not an image");
     }
   else
     print_usage ();
@@ -10926,9 +10881,9 @@
 
           if (args.length () == 1)
             {
-              caseless_str val (args(0).string_value ());
-
-              if (! error_state && val.compare ("expose"))
+              caseless_str val (args(0).xstring_value ("drawnow: expecting argument to be a string"));
+
+              if (val.compare ("expose"))
                 do_events = false;
               else
                 {
@@ -11005,30 +10960,25 @@
                 }
             }
 
-          mono = (args.length () >= 3 ? args(2).bool_value () : false);
-
-          if (! error_state)
-            {
-              debug_file = (args.length () > 3 ? args(3).xstring_value ("drawnow: invalid DEBUG_FILE, expected a string value") : "");
-
-              graphics_handle h = gcf ();
-
-              if (h.ok ())
-                {
-                  graphics_object go = gh_manager::get_object (h);
-
-                  gh_manager::unlock ();
-
-                  go.get_toolkit ().print_figure (go, term, file,
-                                                  mono, debug_file);
-
-                  gh_manager::lock ();
-                }
-              else
-                error ("drawnow: nothing to draw");
+          mono = (args.length () >= 3 ? args(2).xbool_value ("drawnow: invalid colormode MONO, expected a boolean value") : false);
+
+          debug_file = (args.length () > 3 ? args(3).xstring_value ("drawnow: invalid DEBUG_FILE, expected a string value") : "");
+
+          graphics_handle h = gcf ();
+
+          if (h.ok ())
+            {
+              graphics_object go = gh_manager::get_object (h);
+
+              gh_manager::unlock ();
+
+              go.get_toolkit ().print_figure (go, term, file,
+                                              mono, debug_file);
+
+              gh_manager::lock ();
             }
           else
-            error ("drawnow: invalid colormode MONO, expected a boolean value");
+            error ("drawnow: nothing to draw");
         }
       else
         print_usage ();
@@ -11080,32 +11030,27 @@
 
   if (args.length () >= 3 && args.length () <= 4)
     {
-      double h = args(0).double_value ();
-
-      if (! error_state)
-        {
-          std::string pname = args(1).xstring_value ("addlistener: invalid property name, expected a string value");
-
-          graphics_handle gh = gh_manager::lookup (h);
-
-          if (gh.ok ())
-            {
-              graphics_object go = gh_manager::get_object (gh);
-
-              go.add_property_listener (pname, args(2), POSTSET);
-
-              if (args.length () == 4)
-                {
-                  caseless_str persistent = args(3).string_value ();
-                  if (persistent.compare ("persistent"))
-                    go.add_property_listener (pname, args(2), PERSISTENT);
-                }
-            }
-          else
-            error ("addlistener: invalid graphics object (= %g)", h);
+      double h = args(0).xdouble_value ("addlistener: invalid handle");
+
+      std::string pname = args(1).xstring_value ("addlistener: invalid property name, expected a string value");
+
+      graphics_handle gh = gh_manager::lookup (h);
+
+      if (gh.ok ())
+        {
+          graphics_object go = gh_manager::get_object (gh);
+
+          go.add_property_listener (pname, args(2), POSTSET);
+
+          if (args.length () == 4)
+            {
+              caseless_str persistent = args(3).string_value ();
+              if (persistent.compare ("persistent"))
+                go.add_property_listener (pname, args(2), PERSISTENT);
+            }
         }
       else
-        error ("addlistener: invalid handle");
+        error ("addlistener: invalid graphics object (= %g)", h);
     }
   else
     print_usage ();
@@ -11147,39 +11092,34 @@
 
   if (args.length () == 3 || args.length () == 2)
     {
-      double h = args(0).double_value ();
-
-      if (! error_state)
-        {
-          std::string pname = args(1).xstring_value ("dellistener: invalid property name, expected a string value");
-
-          graphics_handle gh = gh_manager::lookup (h);
-
-          if (gh.ok ())
-            {
-              graphics_object go = gh_manager::get_object (gh);
-
-              if (args.length () == 2)
-                go.delete_property_listener (pname, octave_value (), POSTSET);
+      double h = args(0).xdouble_value ("dellistener: invalid handle");
+
+      std::string pname = args(1).xstring_value ("dellistener: invalid property name, expected a string value");
+
+      graphics_handle gh = gh_manager::lookup (h);
+
+      if (gh.ok ())
+        {
+          graphics_object go = gh_manager::get_object (gh);
+
+          if (args.length () == 2)
+            go.delete_property_listener (pname, octave_value (), POSTSET);
+          else
+            {
+              if (args(2).is_string ()
+                  && args(2).string_value () == "persistent")
+                {
+                  go.delete_property_listener (pname, octave_value (),
+                                               PERSISTENT);
+                  go.delete_property_listener (pname, octave_value (),
+                                               POSTSET);
+                }
               else
-                {
-                  if (args(2).is_string ()
-                      && args(2).string_value () == "persistent")
-                    {
-                      go.delete_property_listener (pname, octave_value (),
-                                                   PERSISTENT);
-                      go.delete_property_listener (pname, octave_value (),
-                                                   POSTSET);
-                    }
-                  else
-                    go.delete_property_listener (pname, args(2), POSTSET);
-                }
-            }
-          else
-            error ("dellistener: invalid graphics object (= %g)", h);
+                go.delete_property_listener (pname, args(2), POSTSET);
+            }
         }
       else
-        error ("dellistener: invalid handle");
+        error ("dellistener: invalid graphics object (= %g)", h);
     }
   else
     print_usage ();
@@ -11267,34 +11207,29 @@
     {
       std::string name = args(0).xstring_value ("addproperty: invalid property NAME, expected a string value");
 
-      double h = args(1).double_value ();
-
-      if (! error_state)
-        {
-          graphics_handle gh = gh_manager::lookup (h);
-
-          if (gh.ok ())
-            {
-              graphics_object go = gh_manager::get_object (gh);
-
-              std::string type = args(2).xstring_value ("addproperty: invalid property TYPE, expected a string value");
-
-              if (! go.get_properties ().has_property (name))
-                {
-                  property p = property::create (name, gh, type,
-                                                 args.splice (0, 3));
-
-                  go.get_properties ().insert_property (name, p);
-                }
-              else
-                error ("addproperty: a '%s' property already exists in the graphics object",
-                       name.c_str ());
+      double h = args(1).xdouble_value ("addproperty: invalid handle value");
+
+      graphics_handle gh = gh_manager::lookup (h);
+
+      if (gh.ok ())
+        {
+          graphics_object go = gh_manager::get_object (gh);
+
+          std::string type = args(2).xstring_value ("addproperty: invalid property TYPE, expected a string value");
+
+          if (! go.get_properties ().has_property (name))
+            {
+              property p = property::create (name, gh, type,
+                                             args.splice (0, 3));
+
+              go.get_properties ().insert_property (name, p);
             }
           else
-            error ("addproperty: invalid graphics object (= %g)", h);
+            error ("addproperty: a '%s' property already exists in the graphics object",
+                   name.c_str ());
         }
       else
-        error ("addproperty: invalid handle value");
+        error ("addproperty: invalid graphics object (= %g)", h);
     }
   else
     print_usage ();
@@ -11494,214 +11429,204 @@
 {
   if (args.length () > 0)
     {
-      double h = args(0).double_value ();
-
-      if (! error_state)
-        {
-          caseless_str pname;
-
-          unwind_protect frame;
-
-          static uint32_t id_counter = 0;
-          uint32_t id = 0;
-
-          int max_arg_index = 0;
-          int timeout_index = -1;
-
-          int timeout = 0;
-
-          if (args.length () > 1)
-            {
-              pname = args(1).string_value ();
-
-              if (! error_state
-                  && ! pname.empty () && ! pname.compare ("timeout"))
+      double h = args(0).xdouble_value ("waitfor: invalid handle value");
+
+      caseless_str pname;
+
+      unwind_protect frame;
+
+      static uint32_t id_counter = 0;
+      uint32_t id = 0;
+
+      int max_arg_index = 0;
+      int timeout_index = -1;
+
+      int timeout = 0;
+
+      if (args.length () > 1)
+        {
+          pname = args(1).string_value ();
+
+          if (! error_state
+              && ! pname.empty () && ! pname.compare ("timeout"))
+            {
+              if (pname.compare ("\\timeout"))
+                pname = "timeout";
+
+              static octave_value wf_listener;
+
+              if (! wf_listener.is_defined ())
+                wf_listener =
+                  octave_value (new octave_builtin (waitfor_listener,
+                                                    "waitfor_listener"));
+
+              max_arg_index++;
+              if (args.length () > 2)
                 {
-                  if (pname.compare ("\\timeout"))
-                    pname = "timeout";
-
-                  static octave_value wf_listener;
-
-                  if (! wf_listener.is_defined ())
-                    wf_listener =
-                      octave_value (new octave_builtin (waitfor_listener,
-                                                        "waitfor_listener"));
-
-                  max_arg_index++;
-                  if (args.length () > 2)
+                  if (args(2).is_string ())
                     {
-                      if (args(2).is_string ())
-                        {
-                          caseless_str s = args(2).string_value ();
-
-                          if (s.compare ("timeout"))
-                            timeout_index = 2;
-                          else
-                            max_arg_index++;
-                        }
+                      caseless_str s = args(2).string_value ();
+
+                      if (s.compare ("timeout"))
+                        timeout_index = 2;
                       else
                         max_arg_index++;
                     }
-
-                  Cell listener (1, max_arg_index >= 2 ? 5 : 4);
-
-                  id = id_counter++;
-                  frame.add_fcn (cleanup_waitfor_id, id);
-                  waitfor_results[id] = false;
-
-                  listener(0) = wf_listener;
-                  listener(1) = octave_uint32 (id);
-                  listener(2) = h;
-                  listener(3) = pname;
-
-                  if (max_arg_index >= 2)
-                    listener(4) = args(2);
-
-                  octave_value ov_listener (listener);
-
-                  gh_manager::auto_lock guard;
-
-                  graphics_handle gh = gh_manager::lookup (h);
-
-                  if (gh.ok ())
+                  else
+                    max_arg_index++;
+                }
+
+              Cell listener (1, max_arg_index >= 2 ? 5 : 4);
+
+              id = id_counter++;
+              frame.add_fcn (cleanup_waitfor_id, id);
+              waitfor_results[id] = false;
+
+              listener(0) = wf_listener;
+              listener(1) = octave_uint32 (id);
+              listener(2) = h;
+              listener(3) = pname;
+
+              if (max_arg_index >= 2)
+                listener(4) = args(2);
+
+              octave_value ov_listener (listener);
+
+              gh_manager::auto_lock guard;
+
+              graphics_handle gh = gh_manager::lookup (h);
+
+              if (gh.ok ())
+                {
+                  graphics_object go = gh_manager::get_object (gh);
+
+                  if (max_arg_index >= 2
+                      && compare_property_values (go.get (pname),
+                                                  args(2)))
+                    waitfor_results[id] = true;
+                  else
                     {
-                      graphics_object go = gh_manager::get_object (gh);
-
-                      if (max_arg_index >= 2
-                          && compare_property_values (go.get (pname),
-                                                      args(2)))
-                        waitfor_results[id] = true;
-                      else
+
+                      frame.add_fcn (cleanup_waitfor_postset_listener,
+                                     ov_listener);
+                      go.add_property_listener (pname, ov_listener,
+                                                POSTSET);
+                      go.add_property_listener (pname, ov_listener,
+                                                PERSISTENT);
+
+                      if (go.get_properties ()
+                          .has_dynamic_property (pname))
                         {
-
-                          frame.add_fcn (cleanup_waitfor_postset_listener,
-                                         ov_listener);
-                          go.add_property_listener (pname, ov_listener,
-                                                    POSTSET);
-                          go.add_property_listener (pname, ov_listener,
-                                                    PERSISTENT);
-
-                          if (go.get_properties ()
-                              .has_dynamic_property (pname))
-                            {
-                              static octave_value wf_del_listener;
-
-                              if (! wf_del_listener.is_defined ())
-                                wf_del_listener =
-                                  octave_value (new octave_builtin
-                                                (waitfor_del_listener,
-                                                 "waitfor_del_listener"));
-
-                              Cell del_listener (1, 4);
-
-                              del_listener(0) = wf_del_listener;
-                              del_listener(1) = octave_uint32 (id);
-                              del_listener(2) = h;
-                              del_listener(3) = pname;
-
-                              octave_value ov_del_listener (del_listener);
-
-                              frame.add_fcn (cleanup_waitfor_predelete_listener,
-                                             ov_del_listener);
-                              go.add_property_listener (pname, ov_del_listener,
-                                                        PREDELETE);
-                            }
+                          static octave_value wf_del_listener;
+
+                          if (! wf_del_listener.is_defined ())
+                            wf_del_listener =
+                              octave_value (new octave_builtin
+                                            (waitfor_del_listener,
+                                             "waitfor_del_listener"));
+
+                          Cell del_listener (1, 4);
+
+                          del_listener(0) = wf_del_listener;
+                          del_listener(1) = octave_uint32 (id);
+                          del_listener(2) = h;
+                          del_listener(3) = pname;
+
+                          octave_value ov_del_listener (del_listener);
+
+                          frame.add_fcn (cleanup_waitfor_predelete_listener,
+                                         ov_del_listener);
+                          go.add_property_listener (pname, ov_del_listener,
+                                                    PREDELETE);
                         }
                     }
                 }
-              else if (error_state || pname.empty ())
-                error ("waitfor: invalid property name, expected a non-empty string value");
-            }
-
-          if (timeout_index < 0 && args.length () > (max_arg_index + 1))
-            {
-              caseless_str s = args(max_arg_index + 1).string_value ();
-
-              if (! error_state)
-                {
-                  if (s.compare ("timeout"))
-                    timeout_index = max_arg_index + 1;
-                  else
-                    error ("waitfor: invalid parameter '%s'", s.c_str ());
-                }
+            }
+          else if (error_state || pname.empty ())
+            error ("waitfor: invalid property name, expected a non-empty string value");
+        }
+
+      if (timeout_index < 0 && args.length () > (max_arg_index + 1))
+        {
+          caseless_str s = args(max_arg_index + 1).string_value ();
+
+          if (! error_state)
+            {
+              if (s.compare ("timeout"))
+                timeout_index = max_arg_index + 1;
               else
-                error ("waitfor: invalid parameter, expected 'timeout'");
-            }
-
-          if (timeout_index >= 0)
-            {
-              if (args.length () > (timeout_index + 1))
+                error ("waitfor: invalid parameter '%s'", s.c_str ());
+            }
+          else
+            error ("waitfor: invalid parameter, expected 'timeout'");
+        }
+
+      if (timeout_index >= 0)
+        {
+          if (args.length () > (timeout_index + 1))
+            {
+              timeout = static_cast<int>
+                (args(timeout_index + 1).xscalar_value ("waitfor: invalid timeout value, expected a value >= 1"));
+
+              if (timeout < 1)
                 {
-                  timeout = static_cast<int>
-                            (args(timeout_index + 1).scalar_value ());
-
-                  if (! error_state)
-                    {
-                      if (timeout < 1)
-                        {
-                          warning ("waitfor: the timeout value must be >= 1, using 1 instead");
-                          timeout = 1;
-                        }
-                    }
-                  else
-                    error ("waitfor: invalid timeout value, expected a value >= 1");
+                  warning ("waitfor: the timeout value must be >= 1, using 1 instead");
+                  timeout = 1;
+                }
+            }
+          else
+            error ("waitfor: missing timeout value");
+        }
+
+      // FIXME: There is still a "hole" in the following loop. The code
+      //        assumes that an object handle is unique, which is a fair
+      //        assumption, except for figures.  If a figure is destroyed
+      //        then recreated with the same figure ID, within the same
+      //        run of event hooks, then the figure destruction won't be
+      //        caught and the loop will not stop.  This is an unlikely
+      //        possibility in practice, though.
+      //
+      //        Using deletefcn callback is also unreliable as it could be
+      //        modified during a callback execution and the waitfor loop
+      //        would not stop.
+      //
+      //        The only "good" implementation would require object
+      //        listeners, similar to property listeners.
+
+      time_t start = 0;
+
+      if (timeout > 0)
+        start = time (0);
+
+      while (true)
+        {
+          if (true)
+            {
+              gh_manager::auto_lock guard;
+
+              graphics_handle gh = gh_manager::lookup (h);
+
+              if (gh.ok ())
+                {
+                  if (! pname.empty () && waitfor_results[id])
+                    break;
                 }
               else
-                error ("waitfor: missing timeout value");
-            }
-
-          // FIXME: There is still a "hole" in the following loop. The code
-          //        assumes that an object handle is unique, which is a fair
-          //        assumption, except for figures.  If a figure is destroyed
-          //        then recreated with the same figure ID, within the same
-          //        run of event hooks, then the figure destruction won't be
-          //        caught and the loop will not stop.  This is an unlikely
-          //        possibility in practice, though.
-          //
-          //        Using deletefcn callback is also unreliable as it could be
-          //        modified during a callback execution and the waitfor loop
-          //        would not stop.
-          //
-          //        The only "good" implementation would require object
-          //        listeners, similar to property listeners.
-
-          time_t start = 0;
+                break;
+            }
+
+          octave_usleep (100000);
+
+          OCTAVE_QUIT;
+
+          command_editor::run_event_hooks ();
 
           if (timeout > 0)
-            start = time (0);
-
-          while (true)
-            {
-              if (true)
-                {
-                  gh_manager::auto_lock guard;
-
-                  graphics_handle gh = gh_manager::lookup (h);
-
-                  if (gh.ok ())
-                    {
-                      if (! pname.empty () && waitfor_results[id])
-                        break;
-                    }
-                  else
-                    break;
-                }
-
-              octave_usleep (100000);
-
-              OCTAVE_QUIT;
-
-              command_editor::run_event_hooks ();
-
-              if (timeout > 0)
-                {
-                  if (start + timeout < time (0))
-                    break;
-                }
-            }
-        }
-      else
-        error ("waitfor: invalid handle value.");
+            {
+              if (start + timeout < time (0))
+                break;
+            }
+        }
     }
   else
     print_usage ();
--- a/libinterp/corefcn/input.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/input.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -1288,26 +1288,21 @@
 
   if (nargin == 1 || nargin == 2)
     {
-      std::string hook_fcn_id = args(0).string_value ();
+      std::string hook_fcn_id = args(0).string_value ("remove_input_event_hook: argument not valid as a hook function name or id");
 
       bool warn = (nargin < 2);
 
-      if (! error_state)
-        {
-          hook_function_list::iterator p
-            = input_event_hook_functions.find (hook_fcn_id);
+      hook_function_list::iterator p
+        = input_event_hook_functions.find (hook_fcn_id);
 
-          if (p != input_event_hook_functions.end ())
-            input_event_hook_functions.erase (p);
-          else if (warn)
-            warning ("remove_input_event_hook: %s not found in list",
-                     hook_fcn_id.c_str ());
+      if (p != input_event_hook_functions.end ())
+        input_event_hook_functions.erase (p);
+      else if (warn)
+        warning ("remove_input_event_hook: %s not found in list",
+                 hook_fcn_id.c_str ());
 
-          if (input_event_hook_functions.empty ())
-            command_editor::remove_event_hook (internal_input_event_hook_fcn);
-        }
-      else
-        error ("remove_input_event_hook: argument not valid as a hook function name or id");
+      if (input_event_hook_functions.empty ())
+        command_editor::remove_event_hook (internal_input_event_hook_fcn);
     }
   else
     print_usage ();
--- a/libinterp/corefcn/load-path.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/load-path.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -2427,22 +2427,14 @@
         }
       else if (option_arg.is_numeric_type ())
         {
-          int val = option_arg.int_value ();
-
-          if (! error_state)
+          int val = option_arg.xint_value ("addpath: expecting final argument to be 1 or 0");
+
+          if (val == 0)
+            nargin--;
+          else if (val == 1)
             {
-              if (val == 0)
-                nargin--;
-              else if (val == 1)
-                {
-                  append = true;
-                  nargin--;
-                }
-              else
-                {
-                  error ("addpath: expecting final argument to be 1 or 0");
-                  return retval;
-                }
+              append = true;
+              nargin--;
             }
           else
             {
--- a/libinterp/corefcn/luinc.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/luinc.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -123,53 +123,45 @@
         }
       else if (args(1).is_map ())
         {
-          octave_scalar_map map = args(1).scalar_map_value ();
+          octave_scalar_map map = args(1).xscalar_map_value ("luinc: OPTS must be a scalar structure");
+
+          octave_value tmp;
 
-          if (! error_state)
-            {
-              octave_value tmp;
-
-              tmp = map.getfield ("droptol");
-              if (tmp.is_defined ())
-                droptol = tmp.double_value ();
+          tmp = map.getfield ("droptol");
+          if (tmp.is_defined ())
+            droptol = tmp.double_value ();
 
-              tmp = map.getfield ("milu");
-              if (tmp.is_defined ())
-                {
-                  double val = tmp.double_value ();
+          tmp = map.getfield ("milu");
+          if (tmp.is_defined ())
+            {
+              double val = tmp.double_value ();
 
-                  milu = (val == 0. ? false : true);
-                }
-
-              tmp = map.getfield ("udiag");
-              if (tmp.is_defined ())
-                {
-                  double val = tmp.double_value ();
+              milu = (val == 0. ? false : true);
+            }
 
-                  udiag = (val == 0. ? false : true);
-                }
+          tmp = map.getfield ("udiag");
+          if (tmp.is_defined ())
+            {
+              double val = tmp.double_value ();
 
-              tmp = map.getfield ("thresh");
-              if (tmp.is_defined ())
-                {
-                  thresh = tmp.matrix_value ();
+              udiag = (val == 0. ? false : true);
+            }
 
-                  if (thresh.numel () == 1)
-                    {
-                      thresh.resize (1,2);
-                      thresh(1) = thresh(0);
-                    }
-                  else if (thresh.numel () != 2)
-                    {
-                      error ("luinc: expecting 2-element vector for thresh");
-                      return retval;
-                    }
+          tmp = map.getfield ("thresh");
+          if (tmp.is_defined ())
+            {
+              thresh = tmp.matrix_value ();
+
+              if (thresh.numel () == 1)
+                {
+                  thresh.resize (1,2);
+                  thresh(1) = thresh(0);
                 }
-            }
-          else
-            {
-              error ("luinc: OPTS must be a scalar structure");
-              return retval;
+              else if (thresh.numel () != 2)
+                {
+                  error ("luinc: expecting 2-element vector for thresh");
+                  return retval;
+                }
             }
         }
       else
--- a/libinterp/corefcn/matrix_type.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/matrix_type.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -242,21 +242,16 @@
                     error ("matrix_type: banded matrix type requires 4 arguments");
                   else
                     {
-                      nl = args(2).nint_value ();
-                      nu = args(3).nint_value ();
+                      nl = args(2).xnint_value ("matrix_type: band size NL, NU must be integers");
+                      nu = args(3).xnint_value ("matrix_type: band size NL, NU must be integers");
 
-                      if (error_state)
-                        error ("matrix_type: band size NL, NU must be integers");
+                      if (nl == 1 && nu == 1)
+                        mattyp.mark_as_tridiagonal ();
                       else
-                        {
-                          if (nl == 1 && nu == 1)
-                            mattyp.mark_as_tridiagonal ();
-                          else
-                            mattyp.mark_as_banded (nu, nl);
+                        mattyp.mark_as_banded (nu, nl);
 
-                          if (str_typ == "banded positive definite")
-                            mattyp.mark_as_symmetric ();
-                        }
+                      if (str_typ == "banded positive definite")
+                        mattyp.mark_as_symmetric ();
                     }
                 }
               else if (str_typ == "positive definite")
--- a/libinterp/corefcn/oct-stream.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/oct-stream.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -2359,13 +2359,10 @@
 
   double dval = val.double_value (true);
 
-  if (! error_state)
-    {
-      if (D_NINT (dval) == dval)
-        retval = NINT (dval);
-      else
-        curr_state = conversion_error;
-    }
+  if (D_NINT (dval) == dval)
+    retval = NINT (dval);
+  else
+    curr_state = conversion_error;
 
   return retval;
 }
@@ -3068,57 +3065,52 @@
   int retval = -1;
 
   // FIXME: should we have octave_value methods that handle off_t explicitly?
-  octave_int64 val = tc_offset.int64_scalar_value ();
+  octave_int64 val = tc_offset.xint64_scalar_value ("fseek: invalid value for offset");
   off_t xoffset = val.value ();
 
-  if (! error_state)
+  int conv_err = 0;
+
+  int origin = SEEK_SET;
+
+  if (tc_origin.is_string ())
     {
-      int conv_err = 0;
-
-      int origin = SEEK_SET;
-
-      if (tc_origin.is_string ())
+      std::string xorigin = tc_origin.string_value ("fseek: invalid value for origin");
+
+      if (xorigin == "bof")
+        origin = SEEK_SET;
+      else if (xorigin == "cof")
+        origin = SEEK_CUR;
+      else if (xorigin == "eof")
+        origin = SEEK_END;
+      else
+        conv_err = -1;
+    }
+  else
+    {
+      int xorigin = convert_to_valid_int (tc_origin, conv_err);
+
+      if (! conv_err)
         {
-          std::string xorigin = tc_origin.string_value ();
-
-          if (xorigin == "bof")
+          if (xorigin == -1)
             origin = SEEK_SET;
-          else if (xorigin == "cof")
+          else if (xorigin == 0)
             origin = SEEK_CUR;
-          else if (xorigin == "eof")
+          else if (xorigin == 1)
             origin = SEEK_END;
           else
             conv_err = -1;
         }
-      else
-        {
-          int xorigin = convert_to_valid_int (tc_origin, conv_err);
-
-          if (! conv_err)
-            {
-              if (xorigin == -1)
-                origin = SEEK_SET;
-              else if (xorigin == 0)
-                origin = SEEK_CUR;
-              else if (xorigin == 1)
-                origin = SEEK_END;
-              else
-                conv_err = -1;
-            }
-        }
-
-      if (! conv_err)
-        {
-          retval = seek (xoffset, origin);
-
-          if (retval != 0)
-            error ("fseek: failed to seek to requested position");
-        }
-      else
-        error ("fseek: invalid value for origin");
+    }
+
+  if (! conv_err)
+    {
+      retval = seek (xoffset, origin);
+
+      if (retval != 0)
+        error ("fseek: failed to seek to requested position");
     }
   else
-    error ("fseek: invalid value for offset");
+    error ("fseek: invalid value for origin");
 
   return retval;
 }
--- a/libinterp/corefcn/ordschur.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/ordschur.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -139,13 +139,8 @@
                             || args(1).is_complex_type ();
 
 #define PREPARE_ARGS(TYPE, TYPE_M, TYPE_COND) \
-          TYPE ## Matrix U = args(0).TYPE_M ## _value (); \
-          TYPE ## Matrix S = args(1).TYPE_M ## _value (); \
-          if (error_state) \
-            { \
-              error ("ordschur: U and S must be real or complex floating point matrices"); \
-              return retval; \
-            } \
+          TYPE ## Matrix U = args(0).x ## TYPE_M ## _value ("ordschur: U and S must be real or complex floating point matrices"); \
+          TYPE ## Matrix S = args(1).x ## TYPE_M ## _value ("ordschur: U and S must be real or complex floating point matrices"); \
           TYPE ## Matrix w (dim_vector (n, 1)); \
           TYPE ## Matrix work (dim_vector (n, 1)); \
           octave_idx_type m; \
--- 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)
--- a/libinterp/corefcn/rand.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/rand.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -94,12 +94,8 @@
         additional_arg = false;
       else
         {
-          a = args(0).array_value ();
-          if (error_state)
-            {
-              error ("%s: expecting scalar or matrix arguments", fcn);
-              goto done;
-            }
+          a = args(0).xarray_value ("%s: expecting scalar or matrix arguments", fcn);
+
           idx++;
           nargin--;
         }
@@ -286,12 +282,8 @@
 
             for (int i = 0; i < nargin; i++)
               {
-                octave_idx_type elt = args(idx+i).int_value ();
-                if (error_state)
-                  {
-                    error ("%s: expecting integer arguments", fcn);
-                    goto done;
-                  }
+                octave_idx_type elt = args(idx+i).xint_value ("%s: expecting integer arguments", fcn);
+
                 //Negative is zero for Matlab compatibility
                 dims(i) = elt >= 0 ? elt : 0;
               }
--- a/libinterp/corefcn/spparms.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/spparms.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -155,11 +155,9 @@
         }
       else
         {
-          NDArray vals = args(0).array_value ();
+          NDArray vals = args(0).xarray_value ("spparms: input must be a string or a vector");
 
-          if (error_state)
-            error ("spparms: input must be a string or a vector");
-          else if (vals.numel () > OCTAVE_SPARSE_CONTROLS_SIZE)
+          if (vals.numel () > OCTAVE_SPARSE_CONTROLS_SIZE)
             error ("spparms: too many elements in vector VALS");
           else
             octave_sparse_params::set_vals (vals);
@@ -169,11 +167,9 @@
     {
       std::string str = args(0).xstring_value ("spparms: first argument must be a string");
 
-      double val = args(1).double_value ();
+      double val = args(1).xdouble_value ("spparms: second argument must be a real scalar");
 
-      if (error_state)
-        error ("spparms: second argument must be a real scalar");
-      else if (str == "umfpack")
+      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");
--- a/libinterp/corefcn/strfns.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/strfns.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -95,13 +95,7 @@
 
       for (int i = 0; i < nargin; i++)
         {
-          string_vector s = args(i).all_strings ();
-
-          if (error_state)
-            {
-              error ("char: unable to convert some args to strings");
-              return retval;
-            }
+          string_vector s = args(i).xall_strings ("char: unable to convert some args to strings");
 
           if (s.numel () > 0)
             n_elts += s.numel ();
@@ -216,13 +210,7 @@
 
   for (int i = 0; i < nargin; i++)
     {
-      string_vector s = args(i).all_strings ();
-
-      if (error_state)
-        {
-          error ("strvcat: unable to convert some args to strings");
-          return retval;
-        }
+      string_vector s = args(i).xall_strings ("strvcat: unable to convert some args to strings");
 
       size_t n = s.numel ();
 
@@ -899,26 +887,12 @@
       return retval;
     }
 
-  string_vector s = args(0).all_strings ();
-
-  if (error_state)
-    {
-      error ("list_in_columns: ARG must be a cellstr or char array");
-      return retval;
-    }
+  string_vector s = args(0).xall_strings ("list_in_columns: ARG must be a cellstr or char array");
 
   int width = -1;
 
   if (nargin > 1 && ! args(1).is_empty ())
-    {
-      width = args(1).int_value ();
-
-      if (error_state)
-        {
-          error ("list_in_columns: WIDTH must be an integer");
-          return retval;
-        }
-    }
+    width = args(1).xint_value ("list_in_columns: WIDTH must be an integer");
 
   std::string prefix;
 
@@ -951,5 +925,5 @@
 %!error list_in_columns ()
 %!error list_in_columns (["abc", "def"], 20, 2)
 %!error list_in_columns (["abc", "def"], 20, "  ", 3)
-%!error <invalid conversion from string to real scalar> list_in_columns (["abc", "def"], "a")
+%!error <list_in_columns: WIDTH must be an integer> list_in_columns (["abc", "def"], "a")
 */
--- a/libinterp/corefcn/symtab.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/symtab.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -1795,12 +1795,9 @@
         }
       else
         {
-          int s = arg.int_value ();
+          int s = arg.xint_value ("__dump_symtab_info__: expecting string or scope id");
 
-          if (! error_state)
-            symbol_table::dump (octave_stdout, s);
-          else
-            error ("__dump_symtab_info__: expecting string or scope id");
+          symbol_table::dump (octave_stdout, s);
         }
     }
   else
--- a/libinterp/corefcn/syscalls.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/syscalls.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -195,21 +195,16 @@
 
       if (nargin == 2)
         {
-          string_vector tmp = args(1).all_strings ();
+          string_vector tmp = args(1).xall_strings ("exec: all arguments must be strings");
 
-          if (! error_state)
-            {
-              int len = tmp.numel ();
-
-              exec_args.resize (len + 1);
+          int len = tmp.numel ();
 
-              exec_args[0] = exec_file;
+          exec_args.resize (len + 1);
 
-              for (int i = 0; i < len; i++)
-                exec_args[i+1] = tmp[i];
-            }
-          else
-            error ("exec: all arguments must be strings");
+          exec_args[0] = exec_file;
+
+          for (int i = 0; i < len; i++)
+            exec_args[i+1] = tmp[i];
         }
       else
         {
@@ -299,21 +294,16 @@
 
       if (nargin >= 2)
         {
-          string_vector tmp = args(1).all_strings ();
+          string_vector tmp = args(1).xall_strings ("popen2: all arguments must be strings");
 
-          if (! error_state)
-            {
-              int len = tmp.numel ();
-
-              arg_list.resize (len + 1);
+          int len = tmp.numel ();
 
-              arg_list[0] = exec_file;
+          arg_list.resize (len + 1);
 
-              for (int i = 0; i < len; i++)
-                arg_list[i+1] = tmp[i];
-            }
-          else
-            error ("popen2: all arguments must be strings");
+          arg_list[0] = exec_file;
+
+          for (int i = 0; i < len; i++)
+            arg_list[i+1] = tmp[i];
         }
       else
         {
@@ -322,40 +312,35 @@
           arg_list[0] = exec_file;
         }
 
-      if (! error_state)
-        {
-          bool sync_mode = (nargin == 3 ? args(2).bool_value () : false);
+      bool sync_mode = (nargin == 3 ? args(2).bool_value () : false);
+
+      int fildes[2];
+      std::string msg;
+      pid_t pid;
 
-          int fildes[2];
-          std::string msg;
-          pid_t pid;
-
-          pid = octave_syscalls::popen2 (exec_file, arg_list, sync_mode,
-                                         fildes, msg, interactive);
-          if (pid >= 0)
-            {
-              FILE *ifile = fdopen (fildes[1], "r");
-              FILE *ofile = fdopen (fildes[0], "w");
+      pid = octave_syscalls::popen2 (exec_file, arg_list, sync_mode,
+                                     fildes, msg, interactive);
+      if (pid >= 0)
+        {
+          FILE *ifile = fdopen (fildes[1], "r");
+          FILE *ofile = fdopen (fildes[0], "w");
 
-              std::string nm;
+          std::string nm;
 
-              octave_stream is = octave_stdiostream::create (nm, ifile,
-                                                             std::ios::in);
-
-              octave_stream os = octave_stdiostream::create (nm, ofile,
-                                                             std::ios::out);
+          octave_stream is = octave_stdiostream::create (nm, ifile,
+                                                         std::ios::in);
 
-              Cell file_ids (1, 2);
+          octave_stream os = octave_stdiostream::create (nm, ofile,
+                                                         std::ios::out);
 
-              retval(2) = pid;
-              retval(1) = octave_stream_list::insert (is);
-              retval(0) = octave_stream_list::insert (os);
-            }
-          else
-            error (msg.c_str ());
+          Cell file_ids (1, 2);
+
+          retval(2) = pid;
+          retval(1) = octave_stream_list::insert (is);
+          retval(0) = octave_stream_list::insert (os);
         }
       else
-        error ("popen2: all arguments must be strings");
+        error (msg.c_str ());
     }
   else
     print_usage ();
@@ -845,28 +830,23 @@
     {
       std::string name = args(0).xstring_value ("mkfifo: FILE must be a string");
 
-      int octal_mode = args(1).int_value ();
+      int octal_mode = args(1).xint_value ("mkfifo: MODE must be an integer");
 
-      if (! error_state)
+      if (octal_mode < 0)
+        error ("mkfifo: MODE must be a positive integer value");
+      else
         {
-          if (octal_mode < 0)
-            error ("mkfifo: MODE must be a positive integer value");
-          else
-            {
-              int mode = convert (octal_mode, 8, 10);
+          int mode = convert (octal_mode, 8, 10);
 
-              std::string msg;
+          std::string msg;
 
-              int status = octave_mkfifo (name, mode, msg);
-
-              retval(0) = status;
+          int status = octave_mkfifo (name, mode, msg);
 
-              if (status < 0)
-                retval(1) = msg;
-            }
+          retval(0) = status;
+
+          if (status < 0)
+            retval(1) = msg;
         }
-      else
-        error ("mkfifo: MODE must be an integer");
     }
   else
     print_usage ();
@@ -1078,12 +1058,9 @@
 
   if (args.length () == 1)
     {
-      double mode = args(0).double_value ();
+      double mode = args(0).xdouble_value ("S_ISREG: invalid MODE value");
 
-      if (! error_state)
-        retval = file_stat::is_reg (static_cast<mode_t> (mode));
-      else
-        error ("S_ISREG: invalid MODE value");
+      retval = file_stat::is_reg (static_cast<mode_t> (mode));
     }
   else
     print_usage ();
@@ -1104,12 +1081,9 @@
 
   if (args.length () == 1)
     {
-      double mode = args(0).double_value ();
+      double mode = args(0).xdouble_value ("S_ISDIR: invalid MODE value");
 
-      if (! error_state)
-        retval = file_stat::is_dir (static_cast<mode_t> (mode));
-      else
-        error ("S_ISDIR: invalid MODE value");
+      retval = file_stat::is_dir (static_cast<mode_t> (mode));
     }
   else
     print_usage ();
@@ -1130,12 +1104,9 @@
 
   if (args.length () == 1)
     {
-      double mode = args(0).double_value ();
+      double mode = args(0).xdouble_value ("S_ISCHR: invalid MODE value");
 
-      if (! error_state)
-        retval = file_stat::is_chr (static_cast<mode_t> (mode));
-      else
-        error ("S_ISCHR: invalid MODE value");
+      retval = file_stat::is_chr (static_cast<mode_t> (mode));
     }
   else
     print_usage ();
@@ -1156,12 +1127,9 @@
 
   if (args.length () == 1)
     {
-      double mode = args(0).double_value ();
+      double mode = args(0).xdouble_value ("S_ISBLK: invalid MODE value");
 
-      if (! error_state)
-        retval = file_stat::is_blk (static_cast<mode_t> (mode));
-      else
-        error ("S_ISBLK: invalid MODE value");
+      retval = file_stat::is_blk (static_cast<mode_t> (mode));
     }
   else
     print_usage ();
@@ -1182,12 +1150,9 @@
 
   if (args.length () == 1)
     {
-      double mode = args(0).double_value ();
+      double mode = args(0).xdouble_value ("S_ISFIFO: invalid MODE value");
 
-      if (! error_state)
-        retval = file_stat::is_fifo (static_cast<mode_t> (mode));
-      else
-        error ("S_ISFIFO: invalid MODE value");
+      retval = file_stat::is_fifo (static_cast<mode_t> (mode));
     }
   else
     print_usage ();
@@ -1208,12 +1173,9 @@
 
   if (args.length () == 1)
     {
-      double mode = args(0).double_value ();
+      double mode = args(0).xdouble_value ("S_ISLNK: invalid MODE value");
 
-      if (! error_state)
-        retval = file_stat::is_lnk (static_cast<mode_t> (mode));
-      else
-        error ("S_ISLNK: invalid MODE value");
+      retval = file_stat::is_lnk (static_cast<mode_t> (mode));
     }
   else
     print_usage ();
@@ -1234,12 +1196,9 @@
 
   if (args.length () == 1)
     {
-      double mode = args(0).double_value ();
+      double mode = args(0).xdouble_value ("S_ISSOCK: invalid MODE value");
 
-      if (! error_state)
-        retval = file_stat::is_sock (static_cast<mode_t> (mode));
-      else
-        error ("S_ISSOCK: invalid MODE value");
+      retval = file_stat::is_sock (static_cast<mode_t> (mode));
     }
   else
     print_usage ();
@@ -1404,33 +1363,23 @@
 
   if (nargin == 1 || nargin == 2)
     {
-      pid_t pid = args(0).int_value (true);
+      pid_t pid = args(0).xint_value ("waitpid: OPTIONS must be an integer");
 
-      if (! error_state)
-        {
-          int options = 0;
+      int options = 0;
 
-          if (args.length () == 2)
-            options = args(1).int_value (true);
+      if (args.length () == 2)
+        options = args(1).xint_value ("waitpid: PID must be an integer value");
 
-          if (! error_state)
-            {
-              std::string msg;
+      std::string msg;
 
-              int status = 0;
-
-              pid_t result = octave_syscalls::waitpid (pid, &status,
-                                                       options, msg);
+      int status = 0;
 
-              retval(2) = msg;
-              retval(1) = status;
-              retval(0) = result;
-            }
-          else
-            error ("waitpid: OPTIONS must be an integer");
-        }
-      else
-        error ("waitpid: PID must be an integer value");
+      pid_t result = octave_syscalls::waitpid (pid, &status,
+                                               options, msg);
+
+      retval(2) = msg;
+      retval(1) = status;
+      retval(0) = result;
     }
   else
     print_usage ();
@@ -1450,13 +1399,12 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WIFEXITED: STATUS must be an integer");
 
-      if (! error_state)
-        retval = octave_wait::ifexited (status);
-      else
-        error ("WIFEXITED: STATUS must be an integer");
+      retval = octave_wait::ifexited (status);
     }
+  else
+    print_usage ();
 
   return retval;
 }
@@ -1475,12 +1423,9 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WEXITSTATUS: STATUS must be an integer");
 
-      if (! error_state)
-        retval = octave_wait::exitstatus (status);
-      else
-        error ("WEXITSTATUS: STATUS must be an integer");
+      retval = octave_wait::exitstatus (status);
     }
 
   return retval;
@@ -1498,13 +1443,12 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WIFSIGNALED: STATUS must be an integer");
 
-      if (! error_state)
-        retval = octave_wait::ifsignaled (status);
-      else
-        error ("WIFSIGNALED: STATUS must be an integer");
+      retval = octave_wait::ifsignaled (status);
     }
+  else
+    print_usage ();
 
   return retval;
 }
@@ -1523,13 +1467,12 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WTERMSIG: STATUS must be an integer");
 
-      if (! error_state)
-        retval = octave_wait::termsig (status);
-      else
-        error ("WTERMSIG: STATUS must be an integer");
+      retval = octave_wait::termsig (status);
     }
+  else
+    print_usage ();
 
   return retval;
 }
@@ -1550,13 +1493,12 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WCOREDUMP: STATUS must be an integer");
 
-      if (! error_state)
-        retval = octave_wait::coredump (status);
-      else
-        error ("WCOREDUMP: STATUS must be an integer");
+      retval = octave_wait::coredump (status);
     }
+  else
+    print_usage ();
 
   return retval;
 }
@@ -1576,13 +1518,12 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WIFSTOPPED: STATUS must be an integer");
 
-      if (! error_state)
-        retval = octave_wait::ifstopped (status);
-      else
-        error ("WIFSTOPPED: STATUS must be an integer");
+      retval = octave_wait::ifstopped (status);
     }
+  else
+    print_usage ();
 
   return retval;
 }
@@ -1601,13 +1542,12 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WSTOPSIG: STATUS must be an integer");
 
-      if (! error_state)
         retval = octave_wait::stopsig (status);
-      else
-        error ("WSTOPSIG: STATUS must be an integer");
     }
+  else
+    print_usage ();
 
   return retval;
 }
@@ -1624,13 +1564,12 @@
 
   if (args.length () == 1)
     {
-      int status = args(0).int_value ();
+      int status = args(0).xint_value ("WIFCONTINUED: STATUS must be an integer");
 
-      if (! error_state)
-        retval = octave_wait::ifcontinued (status);
-      else
-        error ("WIFCONTINUED: STATUS must be an integer");
+      retval = octave_wait::ifcontinued (status);
     }
+  else
+    print_usage ();
 
   return retval;
 }
--- a/libinterp/corefcn/sysdep.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/sysdep.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -968,19 +968,14 @@
     {
       octave_value arg = args(0);
 
-      string_vector sv = arg.all_strings ();
+      string_vector sv = arg.all_strings ("tilde_expand: expecting argument to be char or cellstr object");
 
-      if (! error_state)
-        {
-          sv = file_ops::tilde_expand (sv);
+      sv = file_ops::tilde_expand (sv);
 
-          if (arg.is_cellstr ())
-            retval = Cell (arg.dims (), sv);
-          else
-            retval = sv;
-        }
+      if (arg.is_cellstr ())
+        retval = Cell (arg.dims (), sv);
       else
-        error ("tilde_expand: expecting argument to be char or cellstr object");
+        retval = sv;
     }
   else
     print_usage ();
--- a/libinterp/corefcn/time.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/time.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -57,48 +57,48 @@
 }
 
 static inline int
-intfield (const octave_scalar_map& m, const std::string& k)
+intfield (const octave_scalar_map& m, const std::string& k, const char *who)
 {
   int retval = 0;
 
   octave_value v = m.getfield (k);
 
   if (! v.is_empty ())
-    retval = v.int_value ();
+    retval = v.xint_value ("%s: invalid TM_STRUCT argument", who);
 
   return retval;
 }
 
 static inline std::string
-stringfield (const octave_scalar_map& m, const std::string& k)
+stringfield (const octave_scalar_map& m, const std::string& k, const char *who)
 {
   std::string retval;
 
   octave_value v = m.getfield (k);
 
   if (! v.is_empty ())
-    retval = v.string_value ();
+    retval = v.xstring_value ("%s: invalid TM_STRUCT argument", who);
 
   return retval;
 }
 
 static octave_base_tm
-extract_tm (const octave_scalar_map& m)
+extract_tm (const octave_scalar_map& m, const char *who)
 {
   octave_base_tm tm;
 
-  tm.usec (intfield (m, "usec"));
-  tm.sec (intfield (m, "sec"));
-  tm.min (intfield (m, "min"));
-  tm.hour (intfield (m, "hour"));
-  tm.mday (intfield (m, "mday"));
-  tm.mon (intfield (m, "mon"));
-  tm.year (intfield (m, "year"));
-  tm.wday (intfield (m, "wday"));
-  tm.yday (intfield (m, "yday"));
-  tm.isdst (intfield (m, "isdst"));
-  tm.gmtoff (intfield (m, "gmtoff"));
-  tm.zone (stringfield (m, "zone"));
+  tm.usec (intfield (m, "usec", who));
+  tm.sec (intfield (m, "sec", who));
+  tm.min (intfield (m, "min", who));
+  tm.hour (intfield (m, "hour", who));
+  tm.mday (intfield (m, "mday", who));
+  tm.mon (intfield (m, "mon", who));
+  tm.year (intfield (m, "year", who));
+  tm.wday (intfield (m, "wday", who));
+  tm.yday (intfield (m, "yday", who));
+  tm.isdst (intfield (m, "isdst", who));
+  tm.gmtoff (intfield (m, "gmtoff", who));
+  tm.zone (stringfield (m, "zone", who));
 
   return tm;
 }
@@ -275,19 +275,11 @@
 
   if (args.length () == 1)
     {
-      octave_scalar_map map = args(0).scalar_map_value ();
-
-      if (! error_state)
-        {
-          octave_base_tm tm = extract_tm (map);
+      octave_scalar_map map = args(0).xscalar_map_value ("mktime: TM_STRUCT argument must be a structure");
 
-          if (! error_state)
-            retval = octave_time (tm);
-          else
-            error ("mktime: invalid TM_STRUCT argument");
-        }
-      else
-        error ("mktime: TM_STRUCT argument must be a structure");
+      octave_base_tm tm = extract_tm (map, "mktime");
+
+      retval = octave_time (tm);
     }
   else
     print_usage ();
@@ -475,19 +467,11 @@
     {
       std::string fmt = args(0).xstring_value ("strftime: FMT must be a string");
 
-      octave_scalar_map map = args(1).scalar_map_value ();
-
-      if (! error_state)
-        {
-          octave_base_tm tm = extract_tm (map);
+      octave_scalar_map map = args(1).xscalar_map_value ("strftime: TM_STRUCT must be a structure");
 
-          if (! error_state)
-            retval = tm.strftime (fmt);
-          else
-            error ("strftime: invalid TM_STRUCT argument");
-        }
-      else
-        error ("strftime: TM_STRUCT must be a structure");
+      octave_base_tm tm = extract_tm (map, "strftime");
+
+      retval = tm.strftime (fmt);
     }
   else
     print_usage ();
--- a/libinterp/corefcn/utils.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/utils.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -314,9 +314,9 @@
 
   if (nargin == 1 || nargin == 2)
     {
-      string_vector names = args(0).all_strings ();
+      string_vector names = args(0).xall_strings ("file_in_loadpath: FILE argument must be a string");
 
-      if (! error_state && names.numel () > 0)
+      if (names.numel () > 0)
         {
           if (nargin == 1)
             retval =
@@ -333,7 +333,7 @@
             }
         }
       else
-        error ("file_in_loadpath: FILE argument must be a string");
+        error ("file_in_loadpath: FILE argument must not be empty");
     }
   else
     print_usage ();
@@ -395,9 +395,9 @@
     {
       std::string path = args(0).xstring_value ("file_in_path: PATH must be a string");
 
-      string_vector names = args(1).all_strings ();
+      string_vector names = args(1).xall_strings ("file_in_path: FILE argument must be a string");
 
-      if (! error_state && names.numel () > 0)
+      if (names.numel () > 0)
         {
           if (nargin == 2)
             retval = search_path_for_file (path, names);
@@ -413,7 +413,7 @@
             }
         }
       else
-        error ("file_in_path: all arguments must be strings");
+        error ("file_in_path: FILE argument must not be empty");
     }
   else
     print_usage ();
--- a/libinterp/corefcn/variables.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/corefcn/variables.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -779,12 +779,9 @@
 
   if (nargin == 1)
     {
-      bool bval = args(0).bool_value ();
-
-      if (! error_state)
-        var = bval;
-      else
-        error ("%s: expecting arg to be a logical value", nm);
+      bool bval = args(0).xbool_value ("%s: expecting arg to be a logical value", nm);
+
+      var = bval;
     }
   else if (nargin > 1)
     print_usage ();
@@ -854,20 +851,15 @@
 
   if (nargin == 1)
     {
-      int ival = args(0).int_value ();
-
-      if (! error_state)
-        {
-          if (ival < minval)
-            error ("%s: expecting arg to be greater than %d", nm, minval);
-          else if (ival > maxval)
-            error ("%s: expecting arg to be less than or equal to %d",
-                   nm, maxval);
-          else
-            var = ival;
-        }
+      int ival = args(0).xint_value ("%s: expecting arg to be an integer value", nm);
+
+      if (ival < minval)
+        error ("%s: expecting arg to be greater than %d", nm, minval);
+      else if (ival > maxval)
+        error ("%s: expecting arg to be less than or equal to %d",
+               nm, maxval);
       else
-        error ("%s: expecting arg to be an integer value", nm);
+        var = ival;
     }
   else if (nargin > 1)
     print_usage ();
@@ -895,19 +887,14 @@
 
   if (nargin == 1)
     {
-      double dval = args(0).scalar_value ();
-
-      if (! error_state)
-        {
-          if (dval < minval)
-            error ("%s: expecting arg to be greater than %g", minval);
-          else if (dval > maxval)
-            error ("%s: expecting arg to be less than or equal to %g", maxval);
-          else
-            var = dval;
-        }
+      double dval = args(0).xscalar_value ("%s: expecting arg to be a scalar value", nm);
+
+      if (dval < minval)
+        error ("%s: expecting arg to be greater than %g", minval);
+      else if (dval > maxval)
+        error ("%s: expecting arg to be less than or equal to %g", maxval);
       else
-        error ("%s: expecting arg to be a scalar value", nm);
+        var = dval;
     }
   else if (nargin > 1)
     print_usage ();
--- a/libinterp/dldfcn/__glpk__.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/dldfcn/__glpk__.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -307,18 +307,10 @@
       if (tmp.is_defined ()) \
         { \
           if (! tmp.is_empty ()) \
-            { \
-              VAL = tmp.scalar_value (); \
- \
-              if (error_state) \
-                { \
-                  error ("glpk: invalid value in PARAM." NAME); \
-                  return retval; \
-                } \
-            } \
+            VAL = tmp.xscalar_value ("glpk: invalid value in PARAM" NAME); \
           else \
             { \
-              error ("glpk: invalid value in PARAM." NAME); \
+              error ("glpk: invalid value in PARAM" NAME); \
               return retval; \
             } \
         } \
@@ -333,18 +325,10 @@
       if (tmp.is_defined ()) \
         { \
           if (! tmp.is_empty ()) \
-            { \
-              VAL = tmp.int_value (); \
- \
-              if (error_state) \
-                { \
-                  error ("glpk: invalid value in PARAM." NAME); \
-                  return retval; \
-                } \
-            } \
+            VAL = tmp.xint_value ("glpk: invalid value in PARAM" NAME); \
           else \
             { \
-              error ("glpk: invalid value in PARAM." NAME); \
+              error ("glpk: invalid value in PARAM" NAME); \
               return retval; \
             } \
         } \
@@ -374,13 +358,7 @@
   //--            coefficients.
   volatile int mrowsc = args(0).rows ();
 
-  Matrix C (args(0).matrix_value ());
-
-  if (error_state)
-    {
-      error ("__glpk__: invalid value of C");
-      return retval;
-    }
+  Matrix C = args(0).xmatrix_value ("__glpk__: invalid value of C");
 
   double *c = C.fortran_vec ();
   Array<int> rn;
@@ -393,13 +371,7 @@
   // If matrix A is NOT a sparse matrix
   if (args(1).is_sparse_type ())
     {
-      SparseMatrix A = args(1).sparse_matrix_value (); // get the sparse matrix
-
-      if (error_state)
-        {
-          error ("__glpk__: invalid value of A");
-          return retval;
-        }
+      SparseMatrix A = args(1).xsparse_matrix_value ("__glpk__: invalid value of A");
 
       mrowsA = A.rows ();
       octave_idx_type Anc = A.cols ();
@@ -425,13 +397,7 @@
     }
   else
     {
-      Matrix A (args(1).matrix_value ()); // get the matrix
-
-      if (error_state)
-        {
-          error ("__glpk__: invalid value of A");
-          return retval;
-        }
+      Matrix A = args(1).xmatrix_value ("__glpk__: invalid value of A");
 
       mrowsA = A.rows ();
       rn.resize (dim_vector (mrowsA*mrowsc+1, 1));
@@ -456,23 +422,17 @@
 
   //-- 3rd Input. A column array containing the right-hand side value
   //               for each constraint in the constraint matrix.
-  Matrix B (args(2).matrix_value ());
-
-  if (error_state)
-    {
-      error ("__glpk__: invalid value of B");
-      return retval;
-    }
+  Matrix B = args(2).xmatrix_value ("__glpk__: invalid value of B");
 
   double *b = B.fortran_vec ();
 
   //-- 4th Input. An array of length mrowsc containing the lower
   //--            bound on each of the variables.
-  Matrix LB (args(3).matrix_value ());
+  Matrix LB = args(3).xmatrix_value ("__glpk__: invalid value of LB");
 
-  if (error_state || LB.numel () < mrowsc)
+  if (LB.numel () < mrowsc)
     {
-      error ("__glpk__: invalid value of LB");
+      error ("__glpk__: invalid dimensions for LB");
       return retval;
     }
 
@@ -493,11 +453,11 @@
 
   //-- 5th Input. An array of at least length numcols containing the upper
   //--            bound on each of the variables.
-  Matrix UB (args(4).matrix_value ());
+  Matrix UB = args(4).xmatrix_value ("__glpk__: invalid value of UB");
 
-  if (error_state || UB.numel () < mrowsc)
+  if (UB.numel () < mrowsc)
     {
-      error ("__glpk__: invalid value of UB");
+      error ("__glpk__: invalid dimensions for UB");
       return retval;
     }
 
@@ -517,24 +477,12 @@
 
   //-- 6th Input. A column array containing the sense of each constraint
   //--            in the constraint matrix.
-  charMatrix CTYPE (args(5).char_matrix_value ());
-
-  if (error_state)
-    {
-      error ("__glpk__: invalid value of CTYPE");
-      return retval;
-    }
+  charMatrix CTYPE = args(5).char_matrix_value ("__glpk__: invalid value of CTYPE");
 
   char *ctype = CTYPE.fortran_vec ();
 
   //-- 7th Input. A column array containing the types of the variables.
-  charMatrix VTYPE (args(6).char_matrix_value ());
-
-  if (error_state)
-    {
-      error ("__glpk__: invalid value of VARTYPE");
-      return retval;
-    }
+  charMatrix VTYPE = args(6).char_matrix_value ("__glpk__: invalid value of VARTYPE");
 
   Array<int> vartype (dim_vector (mrowsc, 1));
   volatile int isMIP = 0;
@@ -551,13 +499,7 @@
 
   //-- 8th Input. Sense of optimization.
   volatile int sense;
-  double SENSE = args(7).scalar_value ();
-
-  if (error_state)
-    {
-      error ("__glpk__: invalid value of SENSE");
-      return retval;
-    }
+  double SENSE = args(7).scalar_value ("__glpk__: invalid value of SENSE");
 
   if (SENSE >= 0)
     sense = 1;
@@ -565,13 +507,7 @@
     sense = -1;
 
   //-- 9th Input. A structure containing the control parameters.
-  octave_scalar_map PARAM = args(8).scalar_map_value ();
-
-  if (error_state)
-    {
-      error ("__glpk__: invalid value of PARAM");
-      return retval;
-    }
+  octave_scalar_map PARAM = args(8).xscalar_map_value ("__glpk__: invalid value of PARAM");
 
   control_params par;
 
--- a/libinterp/dldfcn/__magick_read__.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/dldfcn/__magick_read__.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -748,12 +748,7 @@
       return output;
     }
 
-  const octave_scalar_map options = args(1).scalar_map_value ();
-  if (error_state)
-    {
-      error ("__magick_read__: OPTIONS must be a struct");
-      return output;
-    }
+  const octave_scalar_map options = args(1).xscalar_map_value ("__magick_read__: OPTIONS must be a struct");
 
   std::vector<Magick::Image> imvec;
   read_file (args(0).string_value (), imvec);
@@ -1405,22 +1400,12 @@
       return retval;
     }
   const std::string filename = args(0).string_value ();
-  const std::string ext      = args(1).string_value ();
+  const std::string ext = args(1).string_value ();
 
-  const octave_scalar_map options = args(4).scalar_map_value ();
-  if (error_state)
-    {
-      error ("__magick_write__: OPTIONS must be a struct");
-      return retval;
-    }
+  const octave_scalar_map options = args(4).xscalar_map_value ("__magick_write__: OPTIONS must be a struct");
 
   const octave_value img  = args(2);
-  const Matrix       cmap = args(3).matrix_value ();
-  if (error_state)
-    {
-      error ("__magick_write__: invalid IMG or MAP");
-      return retval;
-    }
+  const Matrix cmap = args(3).xmatrix_value ("__magick_write__: invalid MAP");
 
   std::vector<Magick::Image> imvec;
 
--- a/libinterp/dldfcn/amd.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/dldfcn/amd.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -137,22 +137,17 @@
       AMD_NAME (_defaults) (Control) ;
       if (nargin > 1)
         {
-          octave_scalar_map arg1 = args(1).scalar_map_value ();
+          octave_scalar_map arg1 = args(1).xscalar_map_value ("amd: OPTS argument must be a scalar structure");
 
-          if (!error_state)
-            {
-              octave_value tmp;
+          octave_value tmp;
 
-              tmp = arg1.getfield ("dense");
-              if (tmp.is_defined ())
-                Control[AMD_DENSE] = tmp.double_value ();
+          tmp = arg1.getfield ("dense");
+          if (tmp.is_defined ())
+            Control[AMD_DENSE] = tmp.double_value ();
 
-              tmp = arg1.getfield ("aggressive");
-              if (tmp.is_defined ())
-                Control[AMD_AGGRESSIVE] = tmp.double_value ();
-            }
-          else
-            error ("amd: OPTS argument must be a scalar structure");
+          tmp = arg1.getfield ("aggressive");
+          if (tmp.is_defined ())
+            Control[AMD_AGGRESSIVE] = tmp.double_value ();
         }
 
       OCTAVE_LOCAL_BUFFER (octave_idx_type, P, n_col);
--- a/libinterp/octave-value/ov-cell.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/octave-value/ov-cell.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -1367,14 +1367,11 @@
         retval = args(0);
       else
         {
-          string_vector s = args(0).all_strings ();
+          string_vector s = args(0).xall_strings ("cellstr: argument STRING must be a 2-D character array");
 
-          if (! error_state)
-            retval = (s.is_empty ()
-                      ? Cell (octave_value (std::string ()))
-                      : Cell (s, true));
-          else
-            error ("cellstr: argument STRING must be a 2-D character array");
+          retval = (s.is_empty ()
+                    ? Cell (octave_value (std::string ()))
+                    : Cell (s, true));
         }
     }
   else
@@ -1424,43 +1421,38 @@
 
   if (nargin == 1)
     {
-      const octave_map m = args(0).map_value ();
+      const octave_map m = args(0).xmap_value ("struct2cell: argument S must be a structure");
 
-      if (! error_state)
-        {
-          const dim_vector m_dv = m.dims ();
+      const dim_vector m_dv = m.dims ();
 
-          octave_idx_type num_fields = m.nfields ();
+      octave_idx_type num_fields = m.nfields ();
 
-          // The resulting dim_vector should have dimensions:
-          // [numel(fields) size(struct)]
-          // except if the struct is a column vector.
+      // The resulting dim_vector should have dimensions:
+      // [numel(fields) size(struct)]
+      // except if the struct is a column vector.
 
-          dim_vector result_dv;
-          if (m_dv(m_dv.length () - 1) == 1)
-            result_dv.resize (m_dv.length ());
-          else
-            result_dv.resize (m_dv.length () + 1); // Add 1 for the fields.
+      dim_vector result_dv;
+      if (m_dv(m_dv.length () - 1) == 1)
+        result_dv.resize (m_dv.length ());
+      else
+        result_dv.resize (m_dv.length () + 1); // Add 1 for the fields.
 
-          result_dv(0) = num_fields;
+      result_dv(0) = num_fields;
 
-          for (int i = 1; i < result_dv.length (); i++)
-            result_dv(i) = m_dv(i-1);
+      for (int i = 1; i < result_dv.length (); i++)
+        result_dv(i) = m_dv(i-1);
 
-          NoAlias<Cell> c (result_dv);
-
-          octave_idx_type n_elts = m.numel ();
+      NoAlias<Cell> c (result_dv);
 
-          // Fill c in one sweep. Note that thanks to octave_map structure,
-          // we don't need a key lookup at all.
-          for (octave_idx_type j = 0; j < n_elts; j++)
-            for (octave_idx_type i = 0; i < num_fields; i++)
-              c(i,j) = m.contents(i)(j);
+      octave_idx_type n_elts = m.numel ();
 
-          retval = c;
-        }
-      else
-        error ("struct2cell: argument S must be a structure");
+      // Fill c in one sweep. Note that thanks to octave_map structure,
+      // we don't need a key lookup at all.
+      for (octave_idx_type j = 0; j < n_elts; j++)
+        for (octave_idx_type i = 0; i < num_fields; i++)
+          c(i,j) = m.contents(i)(j);
+
+      retval = c;
     }
   else
     print_usage ();
--- a/libinterp/octave-value/ov-fcn-inline.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/octave-value/ov-fcn-inline.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -784,32 +784,24 @@
               return retval;
             }
 
-          int n = args(1).int_value ();
+          int n = args(1).int_value ("inline: N must be an integer");
 
-          if (! error_state)
+          if (n >= 0)
             {
-              if (n >= 0)
-                {
-                  fargs.resize (n+1);
-
-                  fargs(0) = "x";
+              fargs.resize (n+1);
 
-                  for (int i = 1; i < n+1; i++)
-                    {
-                      std::ostringstream buf;
-                      buf << "P" << i;
-                      fargs(i) = buf.str ();
-                    }
-                }
-              else
+              fargs(0) = "x";
+
+              for (int i = 1; i < n+1; i++)
                 {
-                  error ("inline: N must be a positive integer or zero");
-                  return retval;
+                  std::ostringstream buf;
+                  buf << "P" << i;
+                  fargs(i) = buf.str ();
                 }
             }
           else
             {
-              error ("inline: N must be an integer");
+              error ("inline: N must be a positive integer or zero");
               return retval;
             }
         }
--- a/libinterp/octave-value/ov-struct.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/octave-value/ov-struct.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -505,22 +505,17 @@
               {
                 if (t_rhs.is_map () || t_rhs.is_object ())
                   {
-                    octave_map rhs_map = t_rhs.map_value ();
+                    octave_map rhs_map = t_rhs.xmap_value ("invalid structure assignment");
+
+                    map.assign (idx.front (), rhs_map);
 
                     if (! error_state)
                       {
-                        map.assign (idx.front (), rhs_map);
-
-                        if (! error_state)
-                          {
-                            count++;
-                            retval = octave_value (this);
-                          }
-                        else
-                          gripe_failed_assignment ();
+                        count++;
+                        retval = octave_value (this);
                       }
                     else
-                      error ("invalid structure assignment");
+                      gripe_failed_assignment ();
                   }
                 else
                   {
--- a/libinterp/octave-value/ov.cc	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/octave-value/ov.cc	Sat Nov 14 15:18:05 2015 -0500
@@ -1994,6 +1994,7 @@
 XVALUE_EXTRACTOR (uint64NDArray, xuint64_array_value, uint64_array_value)
 
 XVALUE_EXTRACTOR (std::string, xstring_value, rep->xstring_value)
+XVALUE_EXTRACTOR (string_vector, xall_strings, all_strings)
 
 XVALUE_EXTRACTOR (Cell, xcell_value, cell_value)
 XVALUE_EXTRACTOR (Array<std::string>, xcellstr_value, cellstr_value)
@@ -2958,10 +2959,9 @@
                    std::string& type_string,
                    std::list<octave_value_list>& idx)
 {
-  const octave_map m = arg.map_value ();
-
-  if (! error_state
-      && m.nfields () == 2 && m.contains ("type") && m.contains ("subs"))
+  const octave_map m = arg.xmap_value ("%s: second argument must be a structure with fields 'type' and 'subs'", name);
+
+  if (m.nfields () == 2 && m.contains ("type") && m.contains ("subs"))
     {
       octave_idx_type nel = m.numel ();
 
--- a/libinterp/octave-value/ov.h	Sat Nov 14 12:07:38 2015 -0500
+++ b/libinterp/octave-value/ov.h	Sat Nov 14 15:18:05 2015 -0500
@@ -1111,6 +1111,8 @@
 
   std::string xstring_value (const char *fmt, ...) const;
 
+  string_vector xall_strings (const char *fmt, ...) const;
+
   Cell xcell_value (const char *fmt, ...) const;
 
   Array<std::string> xcellstr_value (const char *fmt, ...) const;
--- a/test/system.tst	Sat Nov 14 12:07:38 2015 -0500
+++ b/test/system.tst	Sat Nov 14 15:18:05 2015 -0500
@@ -202,13 +202,13 @@
 %! unlink (nm);
 %! assert (r(:), [true; false; false; false; false; false; false]);
 
-%!error <octave_base_value::double_value> S_ISREG ({})
-%!error <octave_base_value::double_value> S_ISDIR ({})
-%!error <octave_base_value::double_value> S_ISCHR ({})
-%!error <octave_base_value::double_value> S_ISBLK ({})
-%!error <octave_base_value::double_value> S_ISFIFO ({})
-%!error <octave_base_value::double_value> S_ISLNK ({})
-%!error <octave_base_value::double_value> S_ISSOCK ({})
+%!error <S_ISREG: invalid MODE value> S_ISREG ({})
+%!error <S_ISDIR: invalid MODE value> S_ISDIR ({})
+%!error <S_ISCHR: invalid MODE value> S_ISCHR ({})
+%!error <S_ISBLK: invalid MODE value> S_ISBLK ({})
+%!error <S_ISFIFO: invalid MODE value> S_ISFIFO ({})
+%!error <S_ISLNK: invalid MODE value> S_ISLNK ({})
+%!error <S_ISSOCK: invalid MODE value> S_ISSOCK ({})
 
 %!error <Invalid call to S_ISREG> S_ISREG ()
 %!error <Invalid call to S_ISDIR> S_ISDIR ()