summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index ecb79ccdcb..0a676eff74 100644
--- a/eval.c
+++ b/eval.c
@@ -509,6 +509,9 @@ exc_setup_message(const rb_execution_context_t *ec, VALUE mesg, VALUE *cause)
*cause = get_ec_errinfo(ec);
}
}
+ else if (!NIL_P(*cause) && !rb_obj_is_kind_of(*cause, rb_eException)) {
+ rb_raise(rb_eTypeError, "exception object expected");
+ }
return mesg;
}