Mercurial > octave
diff libinterp/corefcn/gripes.cc @ 20756:200ae1d650b7
propagate octave_execution_exception objects through try/catch blocks
* gripes.h, gripes.cc (gripe_user_supplied_eval,
gripe_wrong_type_arg): New overloaded functions that accept
octave_execution_exception objects.
* error.h, error.cc (error, verror, error_1, usage_1,
debug_or_throw_exception): New overloaded functions that accept
* octave_execution_exception objects.
* __qp__.cc, cellfun.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
file-io.cc, graphics.cc, graphics.in.h, input.cc, load-path.cc,
ls-mat-ascii.cc, lsode.cc, mex.cc, oct-handle.h, oct-map.cc,
oct-stream.cc, quad.cc, rand.cc, toplev.cc, utils.cc, variables.cc,
__eigs__.cc, ov-base.cc, ov-class.cc, ov-fcn-handle.cc,
ov-oncleanup.cc, ov.cc, octave.cc, oct-parse.in.yy: Propagate
octave_execution_exception objects through try/catch blocks.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 25 Nov 2015 15:27:48 -0500 |
parents | 68e3a747ca02 |
children | b6f2909e7f94 |
line wrap: on
line diff
--- a/libinterp/corefcn/gripes.cc Wed Nov 25 11:32:28 2015 -0800 +++ b/libinterp/corefcn/gripes.cc Wed Nov 25 15:27:48 2015 -0500 @@ -86,7 +86,16 @@ void gripe_user_supplied_eval (const char *name) { - error ("%s: evaluation of user-supplied function failed", name); + octave_execution_exception e; + + gripe_user_supplied_eval (e, name); +} + +void +gripe_user_supplied_eval (const octave_execution_exception& e, + const char *name) +{ + error (e, "%s: evaluation of user-supplied function failed", name); } void @@ -134,8 +143,17 @@ void gripe_wrong_type_arg (const char *name, const char *s, bool is_error) { + octave_execution_exception e; + + gripe_wrong_type_arg (e, name, s, is_error); +} + +void +gripe_wrong_type_arg (const octave_execution_exception& e, + const char *name, const char *s, bool is_error) +{ if (is_error) - error ("%s: wrong type argument '%s'", name, s); + error (e, "%s: wrong type argument '%s'", name, s); else warning ("%s: wrong type argument '%s'", name, s); } @@ -143,30 +161,68 @@ void gripe_wrong_type_arg (const char *name, const std::string& s, bool is_error) { - gripe_wrong_type_arg (name, s.c_str (), is_error); + octave_execution_exception e; + + gripe_wrong_type_arg (e, name, s.c_str (), is_error); +} + +void +gripe_wrong_type_arg (const octave_execution_exception& e, + const char *name, const std::string& s, bool is_error) +{ + gripe_wrong_type_arg (e, name, s.c_str (), is_error); } void gripe_wrong_type_arg (const char *name, const octave_value& tc, bool is_error) { + octave_execution_exception e; + + gripe_wrong_type_arg (e, name, tc, is_error); +} + +void +gripe_wrong_type_arg (const octave_execution_exception& e, + const char *name, const octave_value& tc, + bool is_error) +{ std::string type = tc.type_name (); - gripe_wrong_type_arg (name, type, is_error); + gripe_wrong_type_arg (e, name, type, is_error); } void gripe_wrong_type_arg (const std::string& name, const octave_value& tc, bool is_error) { - gripe_wrong_type_arg (name.c_str (), tc, is_error); + octave_execution_exception e; + + gripe_wrong_type_arg (e, name, tc, is_error); +} + +void +gripe_wrong_type_arg (const octave_execution_exception& e, + const std::string& name, const octave_value& tc, + bool is_error) +{ + gripe_wrong_type_arg (e, name.c_str (), tc, is_error); } void gripe_wrong_type_arg (const char *s, bool is_error) { + octave_execution_exception e; + + gripe_wrong_type_arg (e, s, is_error); +} + +void +gripe_wrong_type_arg (const octave_execution_exception& e, + const char *s, bool is_error) +{ if (is_error) - error ("wrong type argument '%s'", s); + error (e, "wrong type argument '%s'", s); else warning ("wrong type argument '%s'", s); } @@ -174,15 +230,33 @@ void gripe_wrong_type_arg (const std::string& s, bool is_error) { - gripe_wrong_type_arg (s.c_str (), is_error); + octave_execution_exception e; + + gripe_wrong_type_arg (e, s, is_error); +} + +void +gripe_wrong_type_arg (const octave_execution_exception& e, + const std::string& s, bool is_error) +{ + gripe_wrong_type_arg (e, s.c_str (), is_error); } void gripe_wrong_type_arg (const octave_value& tc, bool is_error) { + octave_execution_exception e; + + gripe_wrong_type_arg (e, tc, is_error); +} + +void +gripe_wrong_type_arg (const octave_execution_exception& e, + const octave_value& tc, bool is_error) +{ std::string type = tc.type_name (); - gripe_wrong_type_arg (type, is_error); + gripe_wrong_type_arg (e, type, is_error); } void