From b050cc5ab9b0774bbd16f49f4787f50b07c566fe Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 10 Nov 2013 13:16:33 +0000 Subject: error.c: Exception#cause * error.c (exc_cause): captured previous exception. * eval.c (make_exception): capture previous exception automagically. [Feature #8257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index cbe1206486..a398479fb2 100644 --- a/eval.c +++ b/eval.c @@ -641,6 +641,10 @@ make_exception(int argc, VALUE *argv, int isstr) if (argc > 2) set_backtrace(mesg, argv[2]); } + { + VALUE cause = get_errinfo(); + if (!NIL_P(cause)) rb_iv_set(mesg, "cause", cause); + } return mesg; } -- cgit v1.2.3