summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-10 13:16:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-10 13:16:33 +0000
commitb050cc5ab9b0774bbd16f49f4787f50b07c566fe (patch)
tree959cb4adedf0859ee1979938bb95e27c81a80bba /eval.c
parent2fff948394f1baab5bc97aca5ceab81b087c4bc4 (diff)
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
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 4 insertions, 0 deletions
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;
}