changeset 20780:92958b1ee100

restore stack traces to error messages * error.cc (make_execution_exception): New static function. (usage_1, error_1): Use it to create an octave_execution_object that contains stack trace info.
author John W. Eaton <jwe@octave.org>
date Mon, 30 Nov 2015 22:04:02 -0500
parents b6af3f77d1bd
children d02ffc87d9ee
files libinterp/corefcn/error.cc
diffstat 1 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/error.cc	Mon Nov 30 14:01:19 2015 -0800
+++ b/libinterp/corefcn/error.cc	Mon Nov 30 22:04:02 2015 -0500
@@ -282,6 +282,20 @@
     }
 }
 
+static octave_execution_exception
+make_execution_exception (const char *who)
+{
+  std::ostringstream buf;
+
+  pr_where (buf, who);
+
+  octave_execution_exception retval;
+
+  retval.set_stack_trace (buf.str ());
+
+  return retval;
+}
+
 static void
 debug_or_throw_exception (const octave_execution_exception& e,
                           bool show_stack_trace = false)
@@ -386,9 +400,7 @@
 static void
 usage_1 (const char *id, const char *fmt, va_list args)
 {
-  octave_execution_exception e;
-
-  usage_1 (e, id, fmt, args);
+  usage_1 (make_execution_exception ("usage"), id, fmt, args);
 }
 
 void
@@ -468,9 +480,8 @@
 error_1 (std::ostream& os, const char *name, const char *id,
          const char *fmt, va_list args, bool with_cfn = false)
 {
-  octave_execution_exception e;
-
-  error_1 (e, os, name, id, fmt, args, with_cfn);
+  error_1 (make_execution_exception ("error"), os, name, id, fmt,
+           args, with_cfn);
 }
 
 void