summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/error.c b/error.c
index b5b14decae..d6b8be4c4d 100644
--- a/error.c
+++ b/error.c
@@ -364,6 +364,13 @@ exc_to_s(exc)
}
static VALUE
+exc_to_str(exc)
+ VALUE exc;
+{
+ return rb_funcall(exc, rb_intern("to_s"), 0, 0);
+}
+
+static VALUE
exc_inspect(exc)
VALUE exc;
{
@@ -645,8 +652,8 @@ Init_Exception()
rb_define_method(rb_eException, "exception", exc_exception, -1);
rb_define_method(rb_eException, "initialize", exc_initialize, -1);
rb_define_method(rb_eException, "to_s", exc_to_s, 0);
- rb_define_method(rb_eException, "to_str", exc_to_s, 0);
- rb_define_method(rb_eException, "message", exc_to_s, 0);
+ rb_define_method(rb_eException, "to_str", exc_to_str, 0);
+ rb_define_method(rb_eException, "message", exc_to_str, 0);
rb_define_method(rb_eException, "inspect", exc_inspect, 0);
rb_define_method(rb_eException, "backtrace", exc_backtrace, 0);
rb_define_method(rb_eException, "set_backtrace", exc_set_backtrace, 1);