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 ce959fc221..e5ca4e7c90 100644
--- a/error.c
+++ b/error.c
@@ -955,6 +955,7 @@ name_err_mesg_to_str(VALUE obj)
else {
const char *desc = 0;
VALUE d = 0, args[NAME_ERR_MESG_COUNT];
+ int state = 0;
obj = ptr[1];
switch (TYPE(obj)) {
@@ -968,7 +969,9 @@ name_err_mesg_to_str(VALUE obj)
desc = "false";
break;
default:
- d = rb_protect(rb_inspect, obj, 0);
+ d = rb_protect(rb_inspect, obj, &state);
+ if (state)
+ rb_set_errinfo(Qnil);
if (NIL_P(d) || RSTRING_LEN(d) > 65) {
d = rb_any_to_s(obj);
}