[yast-commit] r67451 - /trunk/ruby-bindings/src/ruby/YRuby.cc
Author: jreidinger Date: Wed Feb 15 16:26:08 2012 New Revision: 67451 URL: http://svn.opensuse.org/viewcvs/yast?rev=67451&view=rev Log: ensure that even if exception is raised we return correct result. Ensure also that for last_exception if exception is called, we still return string with message Modified: trunk/ruby-bindings/src/ruby/YRuby.cc Modified: trunk/ruby-bindings/src/ruby/YRuby.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/ruby-bindings/src/ruby/YRuby.cc?rev=67451&r1=67450&r2=67451&view=diff ============================================================================== --- trunk/ruby-bindings/src/ruby/YRuby.cc (original) +++ trunk/ruby-bindings/src/ruby/YRuby.cc Wed Feb 15 16:26:08 2012 @@ -236,12 +236,18 @@ if (error) { VALUE exception = rb_gv_get("$!"); /* get last exception */ - VALUE reason = rb_funcall(exception, rb_intern("to_s"), 0 ); + VALUE reason = rb_funcall(exception, rb_intern("message"), 0 ); VALUE trace = rb_gv_get("$@"); /* get last exception trace */ VALUE backtrace = rb_funcall(trace, rb_intern("join"), 1, rb_str_new("\n\t", 2)); char* tmp = fmtstr("%s\n\t%s", StringValuePtr(reason), StringValuePtr(backtrace)); y2error("%s.%s failed\n%s", module_name.c_str(), function.c_str(), tmp); + //workaround if last_exception failed, then return always string with message + if(function == "last_exception") //TODO constantify last_exception + { + return YCPString(StringValuePtr(reason)); + } + return YCPVoid(); } else { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jreidinger@svn2.opensuse.org