summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/error.c b/error.c
index b58f0f76d5..217740f9d9 100644
--- a/error.c
+++ b/error.c
@@ -522,9 +522,12 @@ static VALUE
exc_to_s(VALUE exc)
{
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
+ VALUE r = Qnil;
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
- return rb_String(mesg);
+ r = rb_String(mesg);
+ OBJ_INFECT(r, exc);
+ return r;
}
/*