changeset 23456:a62ffdf1f432

show stack trace for wrong type arg errors (bug #50894) * error.h, error.cc (make_execution_exception): Make public. * errwarn.cc (err_user_supplied_eval, err_wrong_type_arg): Initialize execution_exception object.
author John W. Eaton <jwe@octave.org>
date Fri, 28 Apr 2017 15:29:39 -0400
parents 73ff72d3d603
children 21baad6b35c4
files libinterp/corefcn/error.cc libinterp/corefcn/error.h libinterp/corefcn/errwarn.cc
diffstat 3 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/error.cc	Fri Apr 28 11:38:39 2017 -0700
+++ b/libinterp/corefcn/error.cc	Fri Apr 28 15:29:39 2017 -0400
@@ -329,7 +329,7 @@
     pr_where (os, who, frames);
 }
 
-static octave::execution_exception
+octave::execution_exception
 make_execution_exception (const char *who)
 {
   std::ostringstream buf;
--- a/libinterp/corefcn/error.h	Fri Apr 28 11:38:39 2017 -0700
+++ b/libinterp/corefcn/error.h	Fri Apr 28 15:29:39 2017 -0400
@@ -44,6 +44,9 @@
 
 extern OCTINTERP_API int warning_enabled (const std::string& id);
 
+extern OCTINTERP_API octave::execution_exception
+make_execution_exception (const char *who);
+
 extern OCTINTERP_API void
 vmessage (const char *name, const char *fmt, va_list args);
 
--- a/libinterp/corefcn/errwarn.cc	Fri Apr 28 11:38:39 2017 -0700
+++ b/libinterp/corefcn/errwarn.cc	Fri Apr 28 15:29:39 2017 -0400
@@ -141,7 +141,7 @@
 void
 err_user_supplied_eval (const char *name)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_user_supplied_eval (e, name);
 }
@@ -155,7 +155,7 @@
 void
 err_wrong_type_arg (const char *name, const char *s)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_wrong_type_arg (e, name, s);
 }
@@ -170,7 +170,7 @@
 void
 err_wrong_type_arg (const char *name, const std::string& s)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_wrong_type_arg (e, name, s.c_str ());
 }
@@ -185,7 +185,7 @@
 void
 err_wrong_type_arg (const char *name, const octave_value& tc)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_wrong_type_arg (e, name, tc);
 }
@@ -202,7 +202,7 @@
 void
 err_wrong_type_arg (const std::string& name, const octave_value& tc)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_wrong_type_arg (e, name, tc);
 }
@@ -217,7 +217,7 @@
 void
 err_wrong_type_arg (const char *s)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_wrong_type_arg (e, s);
 }
@@ -231,7 +231,7 @@
 void
 err_wrong_type_arg (const std::string& s)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_wrong_type_arg (e, s);
 }
@@ -245,7 +245,7 @@
 void
 err_wrong_type_arg (const octave_value& tc)
 {
-  octave::execution_exception e;
+  octave::execution_exception e = make_execution_exception ("error");
 
   err_wrong_type_arg (e, tc);
 }