changeset 29171:254ee9af5014

maint: More updates to standardize exception naming scheme. * error.cc, error.h, errwarn.cc, errwarn.h, interpreter.cc, interpreter.h, ov-complex.cc, pt-eval.cc, pt-eval.h: Update naming conventions for exceptions to use initial letter of exception type.
author Rik <rik@octave.org>
date Thu, 10 Dec 2020 15:27:14 -0800
parents 3ec3e0a5b69e
children 4363b185d31f
files libinterp/corefcn/error.cc libinterp/corefcn/error.h libinterp/corefcn/errwarn.cc libinterp/corefcn/errwarn.h libinterp/corefcn/interpreter.cc libinterp/corefcn/interpreter.h libinterp/octave-value/ov-complex.cc libinterp/parse-tree/pt-eval.cc libinterp/parse-tree/pt-eval.h
diffstat 9 files changed, 76 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/error.cc	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/corefcn/error.cc	Thu Dec 10 15:27:14 2020 -0800
@@ -72,12 +72,12 @@
 
 OCTAVE_NORETURN
 static void
-error_1 (octave::execution_exception& e, const char *id, const char *fmt,
+error_1 (octave::execution_exception& ee, const char *id, const char *fmt,
          va_list args)
 {
   octave::error_system& es = octave::__get_error_system__ ("error_1");
 
-  es.error_1 (e, id, fmt, args);
+  es.error_1 (ee, id, fmt, args);
 }
 
 OCTAVE_NORETURN
@@ -577,13 +577,13 @@
       }
   }
 
-  void error_system::error_1 (execution_exception& e, const char *id,
+  void error_system::error_1 (execution_exception& ee, const char *id,
                               const char *fmt, va_list args)
   {
-    e.set_identifier (id);
-    e.set_message (format_message (fmt, args));
+    ee.set_identifier (id);
+    ee.set_message (format_message (fmt, args));
 
-    throw_error (e);
+    throw_error (ee);
   }
 
   void error_system::error_1 (const char *id, const char *fmt,
@@ -616,7 +616,7 @@
   {
     std::list<frame_info> stack_info;
 
-    execution_exception e ("error", id, msg, stack_info);
+    execution_exception ee ("error", id, msg, stack_info);
 
     if (! stack.isempty ()
         && ! (stack.contains ("file") && stack.contains ("name")
@@ -624,9 +624,9 @@
       error ("rethrow: STACK struct must contain the fields 'file', 'name', and 'line'");
 
     if (! stack.isempty ())
-      e.set_stack_info (make_stack_frame_list (stack));
+      ee.set_stack_info (make_stack_frame_list (stack));
 
-    throw_error (e);
+    throw_error (ee);
   }
 
   void error_system::vpanic (const char *fmt, va_list args)
@@ -897,25 +897,25 @@
     throw ex;
   }
 
-  void error_system::save_exception (const execution_exception& e)
+  void error_system::save_exception (const execution_exception& ee)
   {
-    last_error_id (e.identifier ());
-    std::string message = e.message ();
+    last_error_id (ee.identifier ());
+    std::string message = ee.message ();
     std::string xmsg
       = (message.size () > 0 && message.back () == '\n'
          ? message.substr (0, message.size () - 1) : message);
     last_error_message (xmsg);
-    last_error_stack (make_stack_map (e.stack_info ()));
+    last_error_stack (make_stack_map (ee.stack_info ()));
   }
 
-  void error_system::display_exception (const execution_exception& e,
+  void error_system::display_exception (const execution_exception& ee,
                                         std::ostream& os) const
   {
     if (m_beep_on_error)
       os << "\a";
 
-    e.display (octave_diary);
-    e.display (os);
+    ee.display (octave_diary);
+    ee.display (os);
   }
 }
 
@@ -975,17 +975,17 @@
 }
 
 void
-verror (octave::execution_exception& e, const char *fmt, va_list args)
+verror (octave::execution_exception& ee, const char *fmt, va_list args)
 {
-  error_1 (e, "", fmt, args);
+  error_1 (ee, "", fmt, args);
 }
 
 void
-error (octave::execution_exception& e, const char *fmt, ...)
+error (octave::execution_exception& ee, const char *fmt, ...)
 {
   va_list args;
   va_start (args, fmt);
-  verror (e, fmt, args);
+  verror (ee, fmt, args);
   va_end (args);
 }
 
--- a/libinterp/corefcn/error.h	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/corefcn/error.h	Thu Dec 10 15:27:14 2020 -0800
@@ -258,7 +258,7 @@
                    va_list args);
 
     OCTAVE_NORETURN
-    void error_1 (execution_exception& e, const char *id, const char *fmt,
+    void error_1 (execution_exception& ee, const char *id, const char *fmt,
                   va_list args);
 
     OCTAVE_NORETURN
@@ -304,11 +304,11 @@
                         = std::list<frame_info> ());
 
     OCTAVE_NORETURN
-    void throw_error (execution_exception& e);
+    void throw_error (execution_exception& ee);
 
-    void save_exception (const execution_exception& e);
+    void save_exception (const execution_exception& ee);
 
-    void display_exception (const execution_exception& e,
+    void display_exception (const execution_exception& ee,
                             std::ostream& os) const;
 
   private:
--- a/libinterp/corefcn/errwarn.cc	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/corefcn/errwarn.cc	Thu Dec 10 15:27:14 2020 -0800
@@ -151,121 +151,121 @@
 void
 err_user_supplied_eval (const char *name)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_user_supplied_eval (e, name);
+  err_user_supplied_eval (ee, name);
 }
 
 void
-err_user_supplied_eval (octave::execution_exception& e, const char *name)
+err_user_supplied_eval (octave::execution_exception& ee, const char *name)
 {
-  error (e, "%s: evaluation of user-supplied function failed", name);
+  error (ee, "%s: evaluation of user-supplied function failed", name);
 }
 
 void
 err_wrong_type_arg (const char *name, const char *s)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_wrong_type_arg (e, name, s);
+  err_wrong_type_arg (ee, name, s);
 }
 
 void
-err_wrong_type_arg (octave::execution_exception& e,
+err_wrong_type_arg (octave::execution_exception& ee,
                     const char *name, const char *s)
 {
-  error (e, "%s: wrong type argument '%s'", name, s);
+  error (ee, "%s: wrong type argument '%s'", name, s);
 }
 
 void
 err_wrong_type_arg (const char *name, const std::string& s)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_wrong_type_arg (e, name, s.c_str ());
+  err_wrong_type_arg (ee, name, s.c_str ());
 }
 
 void
-err_wrong_type_arg (octave::execution_exception& e,
+err_wrong_type_arg (octave::execution_exception& ee,
                     const char *name, const std::string& s)
 {
-  err_wrong_type_arg (e, name, s.c_str ());
+  err_wrong_type_arg (ee, name, s.c_str ());
 }
 
 void
 err_wrong_type_arg (const char *name, const octave_value& tc)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_wrong_type_arg (e, name, tc);
+  err_wrong_type_arg (ee, name, tc);
 }
 
 void
-err_wrong_type_arg (octave::execution_exception& e,
+err_wrong_type_arg (octave::execution_exception& ee,
                     const char *name, const octave_value& tc)
 {
   std::string type = tc.type_name ();
 
-  err_wrong_type_arg (e, name, type);
+  err_wrong_type_arg (ee, name, type);
 }
 
 void
 err_wrong_type_arg (const std::string& name, const octave_value& tc)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_wrong_type_arg (e, name, tc);
+  err_wrong_type_arg (ee, name, tc);
 }
 
 void
-err_wrong_type_arg (octave::execution_exception& e,
+err_wrong_type_arg (octave::execution_exception& ee,
                     const std::string& name, const octave_value& tc)
 {
-  err_wrong_type_arg (e, name.c_str (), tc);
+  err_wrong_type_arg (ee, name.c_str (), tc);
 }
 
 void
 err_wrong_type_arg (const char *s)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_wrong_type_arg (e, s);
+  err_wrong_type_arg (ee, s);
 }
 
 void
-err_wrong_type_arg (octave::execution_exception& e, const char *s)
+err_wrong_type_arg (octave::execution_exception& ee, const char *s)
 {
-  error (e, "wrong type argument '%s'", s);
+  error (ee, "wrong type argument '%s'", s);
 }
 
 void
 err_wrong_type_arg (const std::string& s)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_wrong_type_arg (e, s);
+  err_wrong_type_arg (ee, s);
 }
 
 void
-err_wrong_type_arg (octave::execution_exception& e, const std::string& s)
+err_wrong_type_arg (octave::execution_exception& ee, const std::string& s)
 {
-  err_wrong_type_arg (e, s.c_str ());
+  err_wrong_type_arg (ee, s.c_str ());
 }
 
 void
 err_wrong_type_arg (const octave_value& tc)
 {
-  octave::execution_exception e;
+  octave::execution_exception ee;
 
-  err_wrong_type_arg (e, tc);
+  err_wrong_type_arg (ee, tc);
 }
 
 void
-err_wrong_type_arg (octave::execution_exception& e, const octave_value& tc)
+err_wrong_type_arg (octave::execution_exception& ee, const octave_value& tc)
 {
   std::string type = tc.type_name ();
 
-  err_wrong_type_arg (e, type);
+  err_wrong_type_arg (ee, type);
 }
 
 void
--- a/libinterp/corefcn/errwarn.h	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/corefcn/errwarn.h	Thu Dec 10 15:27:14 2020 -0800
@@ -99,53 +99,53 @@
 err_user_supplied_eval (const char *name);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_user_supplied_eval (octave::execution_exception& e, const char *name);
+err_user_supplied_eval (octave::execution_exception& ee, const char *name);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg (const char *name, const char *s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_wrong_type_arg (octave::execution_exception& e, const char *name,
+err_wrong_type_arg (octave::execution_exception& ee, const char *name,
                     const char *s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg (const char *name, const std::string& s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_wrong_type_arg (octave::execution_exception& e, const char *name,
+err_wrong_type_arg (octave::execution_exception& ee, const char *name,
                     const std::string& s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg (const char *name, const octave_value& tc);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_wrong_type_arg (octave::execution_exception& e, const char *name,
+err_wrong_type_arg (octave::execution_exception& ee, const char *name,
                     const octave_value& tc);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg (const std::string& name, const octave_value& tc);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_wrong_type_arg (octave::execution_exception& e, const std::string& name,
+err_wrong_type_arg (octave::execution_exception& ee, const std::string& name,
                     const octave_value& tc);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg (const char *s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_wrong_type_arg (octave::execution_exception& e, const char *s);
+err_wrong_type_arg (octave::execution_exception& ee, const char *s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg (const std::string& s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_wrong_type_arg (octave::execution_exception& e, const std::string& s);
+err_wrong_type_arg (octave::execution_exception& ee, const std::string& s);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg (const octave_value& tc);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
-err_wrong_type_arg (octave::execution_exception& e, const octave_value& tc);
+err_wrong_type_arg (octave::execution_exception& ee, const octave_value& tc);
 
 OCTAVE_NORETURN OCTINTERP_API extern void
 err_wrong_type_arg_for_binary_op (const octave_value& op);
--- a/libinterp/corefcn/interpreter.cc	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/corefcn/interpreter.cc	Thu Dec 10 15:27:14 2020 -0800
@@ -1815,14 +1815,14 @@
     return m_evaluator.autoloaded_functions ();
   }
 
-  void interpreter::handle_exception (const execution_exception& e)
+  void interpreter::handle_exception (const execution_exception& ee)
   {
-    m_error_system.save_exception (e);
+    m_error_system.save_exception (ee);
 
     // FIXME: use a separate stream instead of std::cerr directly so that
     // error messages can be redirected more easily?  Pass the message
     // to an event manager function?
-    m_error_system.display_exception (e, std::cerr);
+    m_error_system.display_exception (ee, std::cerr);
 
     recover_from_exception ();
   }
--- a/libinterp/corefcn/interpreter.h	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/corefcn/interpreter.h	Thu Dec 10 15:27:14 2020 -0800
@@ -454,7 +454,7 @@
 
     std::list<std::string> autoloaded_functions (void) const;
 
-    void handle_exception (const execution_exception& e);
+    void handle_exception (const execution_exception& ee);
 
     void recover_from_exception (void);
 
--- a/libinterp/octave-value/ov-complex.cc	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/octave-value/ov-complex.cc	Thu Dec 10 15:27:14 2020 -0800
@@ -149,9 +149,9 @@
 {
   std::ostringstream buf;
   buf << scalar.real () << std::showpos << scalar.imag () << 'i';
-  octave::complex_index_exception e (buf.str ());
+  octave::complex_index_exception cie (buf.str ());
 
-  throw e;
+  throw cie;
 }
 
 double
--- a/libinterp/parse-tree/pt-eval.cc	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/parse-tree/pt-eval.cc	Thu Dec 10 15:27:14 2020 -0800
@@ -3899,7 +3899,7 @@
   // variable being indexed, if any, then issue an error.  (Will this also
   // be needed by pt-lvalue, which calls subsref?)
 
-  void tree_evaluator::final_index_error (index_exception& e,
+  void tree_evaluator::final_index_error (index_exception& ie,
                                           const tree_expression *expr)
   {
     std::string extra_message;
@@ -3908,7 +3908,7 @@
       {
         std::string var = expr->name ();
 
-        e.set_var (var);
+        ie.set_var (var);
 
         symbol_table& symtab = m_interpreter.get_symbol_table ();
 
@@ -3924,9 +3924,9 @@
           }
       }
 
-    std::string msg = e.message () + extra_message;
-
-    error_with_id (e.err_id (), "%s", msg.c_str ());
+    std::string msg = ie.message () + extra_message;
+
+    error_with_id (ie.err_id (), "%s", msg.c_str ());
   }
 
   octave_value
--- a/libinterp/parse-tree/pt-eval.h	Thu Dec 10 23:35:06 2020 +0100
+++ b/libinterp/parse-tree/pt-eval.h	Thu Dec 10 15:27:14 2020 -0800
@@ -734,7 +734,7 @@
     octave_value
     string_fill_char (const octave_value_list& args, int nargout);
 
-    void final_index_error (index_exception& e, const tree_expression *expr);
+    void final_index_error (index_exception& ie, const tree_expression *expr);
 
     octave_value do_who (int argc, const string_vector& argv,
                          bool return_list, bool verbose = false);