changeset 20679:19d6f94c21cb

eliminate more uses of error_state * graphics.cc, ls-mat5.cc, urlwrite.cc, xpow.cc, ov-class.cc: Eliminate some uses of error_state.
author John W. Eaton <jwe@octave.org>
date Thu, 05 Nov 2015 15:06:52 -0500
parents 4b00afb5e9c3
children 8787e80a44b2
files libinterp/corefcn/graphics.cc libinterp/corefcn/ls-mat5.cc libinterp/corefcn/urlwrite.cc libinterp/corefcn/xpow.cc libinterp/octave-value/ov-class.cc
diffstat 5 files changed, 260 insertions(+), 267 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/graphics.cc	Wed Nov 04 15:56:22 2015 -0500
+++ b/libinterp/corefcn/graphics.cc	Thu Nov 05 15:06:52 2015 -0500
@@ -2151,16 +2151,11 @@
     {
       for (int i = 0; i < nargin; i += 2)
         {
-          caseless_str pname = args(i).string_value ();
-
-          if (! error_state)
-            {
-              octave_value val = args(i+1);
-
-              set_value_or_default (pname, val);
-            }
-          else
-            error ("set: expecting argument %d to be a property name", i);
+          caseless_str pname = args(i).string_value ("set: expecting argument %d to be a property name", i);
+
+          octave_value val = args(i+1);
+
+          set_value_or_default (pname, val);
         }
     }
 }
@@ -11039,28 +11034,23 @@
 
           if (! error_state)
             {
-              debug_file = (args.length () > 3 ? args(3).string_value () : "");
-
-              if (! error_state)
+              debug_file = (args.length () > 3 ? args(3).string_value ("drawnow: invalid DEBUG_FILE, expected a string value") : "");
+
+              graphics_handle h = gcf ();
+
+              if (h.ok ())
                 {
-                  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");
+                  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 DEBUG_FILE, expected a string value");
+                error ("drawnow: nothing to draw");
             }
           else
             error ("drawnow: invalid colormode MONO, expected a boolean value");
@@ -11705,7 +11695,7 @@
           if (timeout > 0)
             start = time (0);
 
-          while (! error_state)
+          while (true)
             {
               if (true)
                 {
--- a/libinterp/corefcn/ls-mat5.cc	Wed Nov 04 15:56:22 2015 -0500
+++ b/libinterp/corefcn/ls-mat5.cc	Thu Nov 05 15:06:52 2015 -0500
@@ -386,7 +386,7 @@
         read_mat5_integer_data (is, re.fortran_vec (), n, swap, \
                                 static_cast<enum mat5_data_type> (type)); \
   \
-        if (! is || error_state) \
+        if (! is) \
           { \
             error ("load: reading matrix data for '%s'", retval.c_str ()); \
             goto data_read_error; \
@@ -411,7 +411,7 @@
             read_mat5_binary_data (is, im.fortran_vec (), n, swap, \
                                    static_cast<enum mat5_data_type> (type), flt_fmt); \
   \
-            if (! is || error_state) \
+            if (! is) \
               { \
                 error ("load: reading imaginary matrix data for '%s'", \
                        retval.c_str ()); \
@@ -737,7 +737,7 @@
             std::string nm
               = read_mat5_binary_element (is, filename, swap, global, tc2);
 
-            if (! is || error_state)
+            if (! is)
               {
                 error ("load: reading cell data for '%s'", nm.c_str ());
                 goto data_read_error;
@@ -790,7 +790,7 @@
         read_mat5_integer_data (is, ridx, nzmax, swap,
                                 static_cast<enum mat5_data_type> (type));
 
-        if (! is || error_state)
+        if (! is)
           {
             error ("load: reading sparse row data for '%s'", retval.c_str ());
             goto data_read_error;
@@ -812,7 +812,7 @@
         read_mat5_integer_data (is, cidx, nc + 1, swap,
                                 static_cast<enum mat5_data_type> (type));
 
-        if (! is || error_state)
+        if (! is)
           {
             error ("load: reading sparse column data for '%s'",
                    retval.c_str ());
@@ -843,7 +843,7 @@
                                static_cast<enum mat5_data_type> (type),
                                flt_fmt);
 
-        if (! is || error_state)
+        if (! is)
           {
             error ("load: reading sparse matrix data for '%s'",
                    retval.c_str ());
@@ -869,7 +869,7 @@
                                    static_cast<enum mat5_data_type> (type),
                                    flt_fmt);
 
-            if (! is || error_state)
+            if (! is)
               {
                 error ("load: reading imaginary sparse matrix data for '%s'",
                        retval.c_str ());
@@ -892,7 +892,7 @@
         std::string nm
           = read_mat5_binary_element (is, filename, swap, global, tc2);
 
-        if (! is || error_state)
+        if (! is)
           goto data_read_error;
 
         // Octave can handle both "/" and "\" as a directory seperator
@@ -1139,7 +1139,7 @@
                     octave_value fieldtc;
                     read_mat5_binary_element (is, filename, swap, global,
                                               fieldtc);
-                    if (! is || error_state)
+                    if (! is)
                       goto data_read_error;
 
                     elt[i](j) = fieldtc;
@@ -1282,12 +1282,16 @@
                     if (load_path::find_method (classname, "loadobj")
                         != std::string ())
                       {
-                        octave_value_list tmp = feval ("loadobj", tc, 1);
-
-                        if (! error_state)
-                          tc = tmp(0);
-                        else
-                          goto data_read_error;
+                        try
+                          {
+                            octave_value_list tmp = feval ("loadobj", tc, 1);
+
+                            tc = tmp(0);
+                          }
+                        catch (const octave_execution_exception&)
+                          {
+                            goto data_read_error;
+                          }
                       }
                   }
                 else
@@ -1373,7 +1377,7 @@
                                static_cast<enum mat5_data_type> (type),
                                flt_fmt);
 
-        if (! is || error_state)
+        if (! is)
           {
             error ("load: reading matrix data for '%s'", retval.c_str ());
             goto data_read_error;
@@ -1399,7 +1403,7 @@
                                    static_cast<enum mat5_data_type> (type),
                                    flt_fmt);
 
-            if (! is || error_state)
+            if (! is)
               {
                 error ("load: reading imaginary matrix data for '%s'",
                        retval.c_str ());
@@ -1442,7 +1446,7 @@
                                static_cast<enum mat5_data_type> (type),
                                flt_fmt);
 
-        if (! is || error_state)
+        if (! is)
           {
             error ("load: reading matrix data for '%s'", retval.c_str ());
             goto data_read_error;
@@ -1481,7 +1485,7 @@
                                    static_cast<enum mat5_data_type> (type),
                                    flt_fmt);
 
-            if (! is || error_state)
+            if (! is)
               {
                 error ("load: reading imaginary matrix data for '%s'",
                        retval.c_str ());
@@ -1611,7 +1615,7 @@
       bool global;
       read_mat5_binary_element (is, filename, swap, global, tc);
 
-      if (!is || error_state)
+      if (! is)
         return -1;
 
       if (tc.is_uint8_type ())
@@ -1631,7 +1635,7 @@
 
           read_mat5_binary_element (fh_ws, filename, swap, global, subsys_ov);
 
-          if (error_state)
+          if (! is)
             return -1;
         }
       else
@@ -2703,11 +2707,16 @@
           && load_path::find_method (tc.class_name (),
                                      "saveobj") != std::string ())
         {
-          octave_value_list tmp = feval ("saveobj", tc, 1);
-          if (! error_state)
-            m = tmp(0).map_value ();
-          else
-            goto error_cleanup;
+          try
+            {
+              octave_value_list tmp = feval ("saveobj", tc, 1);
+
+              m = tmp(0).map_value ();
+            }
+          catch (const octave_execution_exception&)
+            {
+              goto error_cleanup;
+            }
         }
       else
         m = tc.map_value ();
--- a/libinterp/corefcn/urlwrite.cc	Wed Nov 04 15:56:22 2015 -0500
+++ b/libinterp/corefcn/urlwrite.cc	Thu Nov 05 15:06:52 2015 -0500
@@ -190,12 +190,7 @@
     url_transfer obj (host, user, passwd, os);
 
     if (obj.is_valid ())
-      {
-        if (! error_state)
-          handle_map[h] = obj;
-        else
-          h = curl_handle ();
-      }
+      handle_map[h] = obj;
     else
       error ("support for url transfers was disabled when Octave was built");
 
@@ -634,10 +629,7 @@
           if (nargin > 1)
             path = args(1).string_value ("__ftp_cwd__: PATH must be a string");
 
-          if (! error_state)
-            curl.cwd (path);
-          else
-            error ("__ftp_cwd__: expecting path as second argument");
+          curl.cwd (path);
         }
       else
         error ("__ftp_cwd__: invalid ftp handle");
@@ -844,10 +836,7 @@
         {
           std::string file = args(1).string_value ("__ftp_delete__: FILE must be a string");
 
-          if (! error_state)
-            curl.del (file);
-          else
-            error ("__ftp_delete__: expecting file name as second argument");
+          curl.del (file);
         }
       else
         error ("__ftp_delete__: invalid ftp handle");
@@ -876,10 +865,7 @@
         {
           std::string dir = args(1).string_value ("__ftp_rmdir__: DIR must be a string");
 
-          if (! error_state)
-            curl.rmdir (dir);
-          else
-            error ("__ftp_rmdir__: expecting directory name as second argument");
+          curl.rmdir (dir);
         }
       else
         error ("__ftp_rmdir__: invalid ftp handle");
@@ -908,10 +894,7 @@
         {
           std::string dir = args(1).string_value ("__ftp_mkdir__: DIR must be a string");
 
-          if (! error_state)
-            curl.mkdir (dir);
-          else
-            error ("__ftp_mkdir__: expecting directory name as second argument");
+          curl.mkdir (dir);
         }
       else
         error ("__ftp_mkdir__: invalid ftp handle");
@@ -941,10 +924,7 @@
           std::string oldname = args(1).string_value ("__ftp_rename__: OLDNAME must be a string");
           std::string newname = args(2).string_value ("__ftp_rename__: NEWNAME must be a string");
 
-          if (! error_state)
-            curl.rename (oldname, newname);
-          else
-            error ("__ftp_rename__: expecting file names for second and third arguments");
+          curl.rename (oldname, newname);
         }
       else
         error ("__ftp_rename__: invalid ftp handle");
@@ -973,66 +953,61 @@
         {
           std::string pat = args(1).string_value ("__ftp_mput__: PATTERN must be a string");
 
-          if (! error_state)
+          string_vector file_list;
+
+          glob_match pattern (file_ops::tilde_expand (pat));
+          string_vector files = pattern.glob ();
+
+          for (octave_idx_type i = 0; i < files.numel (); i++)
             {
-              string_vector file_list;
+              std::string file = files (i);
+
+              file_stat fs (file);
 
-              glob_match pattern (file_ops::tilde_expand (pat));
-              string_vector files = pattern.glob ();
+              if (! fs.exists ())
+                {
+                  error ("__ftp__mput: file does not exist");
+                  break;
+                }
 
-              for (octave_idx_type i = 0; i < files.numel (); i++)
+              if (fs.is_dir ())
                 {
-                  std::string file = files (i);
+                  file_list.append (curl.mput_directory ("", file));
 
-                  file_stat fs (file);
+                  if (! curl.good ())
+                    {
+                      error ("__ftp_mput__: %s", curl.lasterror().c_str());
+                      break;
+                    }
+                }
+              else
+                {
+                  // FIXME: Does ascii mode need to be flagged here?
+                  std::ifstream ifile (file.c_str (), std::ios::in |
+                                       std::ios::binary);
 
-                  if (! fs.exists ())
+                  if (! ifile.is_open ())
                     {
-                      error ("__ftp__mput: file does not exist");
+                      error ("__ftp_mput__: unable to open file");
                       break;
                     }
 
-                  if (fs.is_dir ())
-                    {
-                      file_list.append (curl.mput_directory ("", file));
+                  curl.put (file, ifile);
 
-                      if (! curl.good ())
-                        {
-                          error ("__ftp_mput__: %s", curl.lasterror().c_str());
-                          break;
-                        }
-                    }
-                  else
-                    {
-                      // FIXME: Does ascii mode need to be flagged here?
-                      std::ifstream ifile (file.c_str (), std::ios::in |
-                                           std::ios::binary);
+                  ifile.close ();
 
-                      if (! ifile.is_open ())
-                        {
-                          error ("__ftp_mput__: unable to open file");
-                          break;
-                        }
-
-                      curl.put (file, ifile);
-
-                      ifile.close ();
+                  if (! curl.good ())
+                    {
+                      error ("__ftp_mput__: %s", curl.lasterror().c_str());
+                      break;
+                    }
 
-                      if (! curl.good ())
-                        {
-                          error ("__ftp_mput__: %s", curl.lasterror().c_str());
-                          break;
-                        }
+                  file_list.append (file);
+                }
+            }
 
-                      file_list.append (file);
-                    }
-                }
-
-              if (nargout > 0)
-                retval = file_list;
-            }
-          else
-            error ("__ftp_mput__: expecting file name patter as second argument");
+          if (nargout > 0)
+            retval = file_list;
         }
       else
         error ("__ftp_mput__: invalid ftp handle");
@@ -1066,63 +1041,59 @@
           if (nargin == 3)
             target = args(2).string_value ("__ftp_mget__: TARGET must be a string") + file_ops::dir_sep_str ();
 
-          if (! error_state)
-            {
-              string_vector sv = curl.list ();
-              octave_idx_type n = 0;
-              glob_match pattern (file);
+          string_vector sv = curl.list ();
+          octave_idx_type n = 0;
+          glob_match pattern (file);
 
 
-              for (octave_idx_type i = 0; i < sv.numel (); i++)
+          for (octave_idx_type i = 0; i < sv.numel (); i++)
+            {
+              if (pattern.match (sv(i)))
                 {
-                  if (pattern.match (sv(i)))
-                    {
-                      n++;
+                  n++;
+
+                  time_t ftime;
+                  bool fisdir;
+                  double fsize;
 
-                      time_t ftime;
-                      bool fisdir;
-                      double fsize;
+                  curl.get_fileinfo (sv(i), fsize, ftime, fisdir);
 
-                      curl.get_fileinfo (sv(i), fsize, ftime, fisdir);
+                  if (fisdir)
+                    curl.mget_directory (sv(i), target);
+                  else
+                    {
+                      std::ofstream ofile ((target + sv(i)).c_str (),
+                                           std::ios::out |
+                                           std::ios::binary);
 
-                      if (fisdir)
-                        curl.mget_directory (sv(i), target);
-                      else
+                      if (! ofile.is_open ())
                         {
-                          std::ofstream ofile ((target + sv(i)).c_str (),
-                                               std::ios::out |
-                                               std::ios::binary);
-
-                          if (! ofile.is_open ())
-                            {
-                              error ("__ftp_mget__: unable to open file");
-                              break;
-                            }
-
-                          unwind_protect_safe frame;
-
-                          frame.add_fcn (delete_file, target + sv(i));
-
-                          curl.get (sv(i), ofile);
-
-                          ofile.close ();
-
-                          if (curl.good ())
-                            frame.discard ();
+                          error ("__ftp_mget__: unable to open file");
+                          break;
                         }
 
-                      if (! curl.good ())
-                        {
-                          error ("__ftp_mget__: %s", curl.lasterror().c_str());
-                          break;
-                        }
+                      unwind_protect_safe frame;
+
+                      frame.add_fcn (delete_file, target + sv(i));
+
+                      curl.get (sv(i), ofile);
+
+                      ofile.close ();
+
+                      if (curl.good ())
+                        frame.discard ();
+                    }
+
+                  if (! curl.good ())
+                    {
+                      error ("__ftp_mget__: %s", curl.lasterror().c_str());
+                      break;
                     }
                 }
-              if (n == 0)
-                error ("__ftp_mget__: file not found");
             }
-          else
-            error ("__ftp_mget__: expecting file name and target as second and third arguments");
+
+          if (n == 0)
+            error ("__ftp_mget__: file not found");
         }
       else
         error ("__ftp_mget__: invalid ftp handle");
--- a/libinterp/corefcn/xpow.cc	Wed Nov 04 15:56:22 2015 -0500
+++ b/libinterp/corefcn/xpow.cc	Thu Nov 05 15:06:52 2015 -0500
@@ -54,6 +54,12 @@
 
 #include "bsxfun.h"
 
+static void
+gripe_failed_diagonalization (void)
+{
+  gripe_failed_diagonalization ();
+}
+
 static inline int
 xisint (double x)
 {
@@ -106,10 +112,10 @@
     error ("for x^A, A must be a square matrix. Use .^ for elementwise power.");
   else
     {
-      EIG b_eig (b);
-
-      if (! error_state)
+      try
         {
+          EIG b_eig (b);
+
           ComplexColumnVector lambda (b_eig.eigenvalues ());
           ComplexMatrix Q (b_eig.eigenvectors ());
 
@@ -129,8 +135,10 @@
           else
             retval = C;
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -159,7 +167,7 @@
     {
       EIG b_eig (b);
 
-      if (! error_state)
+      try
         {
           ComplexColumnVector lambda (b_eig.eigenvalues ());
           ComplexMatrix Q (b_eig.eigenvectors ());
@@ -176,8 +184,10 @@
 
           retval = ComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -248,7 +258,7 @@
         {
           EIG a_eig (a);
 
-          if (! error_state)
+          try
             {
               ComplexColumnVector lambda (a_eig.eigenvalues ());
               ComplexMatrix Q (a_eig.eigenvectors ());
@@ -260,8 +270,10 @@
 
               retval = ComplexMatrix (Q * D * Q.inverse ());
             }
-          else
-            error ("xpow: matrix diagonalization failed");
+          catch (const octave_execution_exception&)
+            {
+              gripe_failed_diagonalization ();
+            }
         }
     }
 
@@ -327,7 +339,7 @@
     {
       EIG a_eig (a);
 
-      if (! error_state)
+      try
         {
           ComplexColumnVector lambda (a_eig.eigenvalues ());
           ComplexMatrix Q (a_eig.eigenvectors ());
@@ -339,8 +351,10 @@
 
           retval = ComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -375,7 +389,7 @@
     {
       EIG b_eig (b);
 
-      if (! error_state)
+      try
         {
           ComplexColumnVector lambda (b_eig.eigenvalues ());
           ComplexMatrix Q (b_eig.eigenvectors ());
@@ -392,8 +406,10 @@
 
           retval = ComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -423,7 +439,7 @@
     {
       EIG b_eig (b);
 
-      if (! error_state)
+      try
         {
           ComplexColumnVector lambda (b_eig.eigenvalues ());
           ComplexMatrix Q (b_eig.eigenvectors ());
@@ -440,8 +456,10 @@
 
           retval = ComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -512,7 +530,7 @@
         {
           EIG a_eig (a);
 
-          if (! error_state)
+          try
             {
               ComplexColumnVector lambda (a_eig.eigenvalues ());
               ComplexMatrix Q (a_eig.eigenvectors ());
@@ -524,8 +542,10 @@
 
               retval = ComplexMatrix (Q * D * Q.inverse ());
             }
-          else
-            error ("xpow: matrix diagonalization failed");
+          catch (const octave_execution_exception&)
+            {
+              gripe_failed_diagonalization ();
+            }
         }
     }
 
@@ -547,7 +567,7 @@
     {
       EIG a_eig (a);
 
-      if (! error_state)
+      try
         {
           ComplexColumnVector lambda (a_eig.eigenvalues ());
           ComplexMatrix Q (a_eig.eigenvectors ());
@@ -559,8 +579,10 @@
 
           retval = ComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -1553,7 +1575,7 @@
     {
       FloatEIG b_eig (b);
 
-      if (! error_state)
+      try
         {
           FloatComplexColumnVector lambda (b_eig.eigenvalues ());
           FloatComplexMatrix Q (b_eig.eigenvectors ());
@@ -1575,8 +1597,10 @@
           else
             retval = C;
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -1605,7 +1629,7 @@
     {
       FloatEIG b_eig (b);
 
-      if (! error_state)
+      try
         {
           FloatComplexColumnVector lambda (b_eig.eigenvalues ());
           FloatComplexMatrix Q (b_eig.eigenvectors ());
@@ -1622,8 +1646,10 @@
 
           retval = FloatComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -1694,7 +1720,7 @@
         {
           FloatEIG a_eig (a);
 
-          if (! error_state)
+          try
             {
               FloatComplexColumnVector lambda (a_eig.eigenvalues ());
               FloatComplexMatrix Q (a_eig.eigenvectors ());
@@ -1706,8 +1732,10 @@
 
               retval = FloatComplexMatrix (Q * D * Q.inverse ());
             }
-          else
-            error ("xpow: matrix diagonalization failed");
+          catch (const octave_execution_exception&)
+            {
+              gripe_failed_diagonalization ();
+            }
         }
     }
 
@@ -1762,7 +1790,7 @@
     {
       FloatEIG a_eig (a);
 
-      if (! error_state)
+      try
         {
           FloatComplexColumnVector lambda (a_eig.eigenvalues ());
           FloatComplexMatrix Q (a_eig.eigenvectors ());
@@ -1774,8 +1802,10 @@
 
           retval = FloatComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -1810,7 +1840,7 @@
     {
       FloatEIG b_eig (b);
 
-      if (! error_state)
+      try
         {
           FloatComplexColumnVector lambda (b_eig.eigenvalues ());
           FloatComplexMatrix Q (b_eig.eigenvectors ());
@@ -1827,8 +1857,10 @@
 
           retval = FloatComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -1858,7 +1890,7 @@
     {
       FloatEIG b_eig (b);
 
-      if (! error_state)
+      try
         {
           FloatComplexColumnVector lambda (b_eig.eigenvalues ());
           FloatComplexMatrix Q (b_eig.eigenvectors ());
@@ -1875,8 +1907,10 @@
 
           retval = FloatComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
@@ -1947,7 +1981,7 @@
         {
           FloatEIG a_eig (a);
 
-          if (! error_state)
+          try
             {
               FloatComplexColumnVector lambda (a_eig.eigenvalues ());
               FloatComplexMatrix Q (a_eig.eigenvectors ());
@@ -1959,8 +1993,10 @@
 
               retval = FloatComplexMatrix (Q * D * Q.inverse ());
             }
-          else
-            error ("xpow: matrix diagonalization failed");
+          catch (const octave_execution_exception&)
+            {
+              gripe_failed_diagonalization ();
+            }
         }
     }
 
@@ -1982,7 +2018,7 @@
     {
       FloatEIG a_eig (a);
 
-      if (! error_state)
+      try
         {
           FloatComplexColumnVector lambda (a_eig.eigenvalues ());
           FloatComplexMatrix Q (a_eig.eigenvectors ());
@@ -1994,8 +2030,10 @@
 
           retval = FloatComplexMatrix (Q * D * Q.inverse ());
         }
-      else
-        error ("xpow: matrix diagonalization failed");
+      catch (const octave_execution_exception&)
+        {
+          gripe_failed_diagonalization ();
+        }
     }
 
   return retval;
--- a/libinterp/octave-value/ov-class.cc	Wed Nov 04 15:56:22 2015 -0500
+++ b/libinterp/octave-value/ov-class.cc	Thu Nov 05 15:06:52 2015 -0500
@@ -289,19 +289,14 @@
 
   octave_map my_map = (obvp != this) ? obvp->map_value () : map;
 
-  std::string nm = idx(0).string_value ();
+  std::string nm = idx(0).string_value ("invalid index for class");
 
-  if (! error_state)
-    {
-      octave_map::const_iterator p = my_map.seek (nm);
+  octave_map::const_iterator p = my_map.seek (nm);
 
-      if (p != my_map.end ())
-        retval = my_map.contents (p);
-      else
-        error ("class has no member '%s'", nm.c_str ());
-    }
+  if (p != my_map.end ())
+    retval = my_map.contents (p);
   else
-    gripe_invalid_index1 ();
+    error ("class has no member '%s'", nm.c_str ());
 
   return retval;
 }
@@ -655,37 +650,32 @@
 
                 assert (key_idx.length () == 1);
 
-                std::string key = key_idx(0).string_value ();
+                std::string key = key_idx(0).string_value ("invalid index for class assignment");
 
-                if (! error_state)
-                  {
-                    octave_value u;
+                octave_value u;
 
-                    if (! map.contains (key))
-                      u = octave_value::empty_conv (type.substr (2), rhs);
-                    else
-                      {
-                        Cell map_val = map.contents (key);
+                if (! map.contains (key))
+                  u = octave_value::empty_conv (type.substr (2), rhs);
+                else
+                  {
+                    Cell map_val = map.contents (key);
 
-                        Cell map_elt = map_val.index (idx.front (), true);
+                    Cell map_elt = map_val.index (idx.front (), true);
 
-                        u = numeric_conv (map_elt, type.substr (2));
-                      }
+                    u = numeric_conv (map_elt, type.substr (2));
+                  }
 
-                    std::list<octave_value_list> next_idx (idx);
-
-                    // We handled two index elements, so subsasgn to
-                    // needs to skip both of them.
+                std::list<octave_value_list> next_idx (idx);
 
-                    next_idx.erase (next_idx.begin ());
-                    next_idx.erase (next_idx.begin ());
-
-                    u.make_unique ();
+                // We handled two index elements, so subsasgn to
+                // needs to skip both of them.
 
-                    t_rhs = u.subsasgn (type.substr (2), next_idx, rhs);
-                  }
-                else
-                  gripe_invalid_index_for_assignment ();
+                next_idx.erase (next_idx.begin ());
+                next_idx.erase (next_idx.begin ());
+
+                u.make_unique ();
+
+                t_rhs = u.subsasgn (type.substr (2), next_idx, rhs);
               }
             else
               gripe_invalid_index_for_assignment ();
@@ -757,19 +747,14 @@
 
                 assert (key_idx.length () == 1);
 
-                std::string key = key_idx(0).string_value ();
+                std::string key = key_idx(0).string_value ("assignment to class element failed");
+
+                map.assign (idx.front (), key, t_rhs);
 
                 if (! error_state)
                   {
-                    map.assign (idx.front (), key, t_rhs);
-
-                    if (! error_state)
-                      {
-                        count++;
-                        retval = octave_value (this);
-                      }
-                    else
-                      gripe_failed_assignment ();
+                    count++;
+                    retval = octave_value (this);
                   }
                 else
                   gripe_failed_assignment ();