diff options
author | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-02-20 08:56:42 +0000 |
---|---|---|
committer | (no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-02-20 08:56:42 +0000 |
commit | 21e36414c9b1d21f593a236a6a20df507a33b986 (patch) | |
tree | c77cf738688717f0571e9eb09ad99c1dadfded86 /error.c | |
parent | fd1d8cdc09ed86e4a0812120a17ff0d7b04adcaf (diff) |
This commit was manufactured by cvs2svn to create tag 'v1_1b8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_1b8@87 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -6,7 +6,7 @@ $Date$ created at: Mon Aug 9 16:11:34 JST 1993 - Copyright (C) 1993-1996 Yukihiro Matsumoto + Copyright (C) 1993-1998 Yukihiro Matsumoto ************************************************/ @@ -168,8 +168,19 @@ rb_check_type(x, t) if (TYPE(x)!=(t)) { while (type->type >= 0) { if (type->type == t) { + char *etype; + + if (NIL_P(x)) { + etype = "nil"; + } + else if (rb_special_const_p(x)) { + etype = RSTRING(obj_as_string(x))->ptr; + } + else { + etype = rb_class2name(CLASS_OF(x)); + } TypeError("wrong argument type %s (expected %s)", - rb_class2name(CLASS_OF(x)), type->name); + etype, type->name); } type++; } @@ -254,7 +265,7 @@ exc_inspect(exc) klass = CLASS_OF(exc); if (RSTRING(exc)->len == 0) { - return rb_class_path(klass); + return str_dup(rb_class_path(klass)); } str = str_new2("#<"); @@ -342,7 +353,7 @@ Init_Exception() rb_define_global_function("Exception", exception, -1); } -#define RAISE_ERROR(class) {\ +#define RAISE_ERROR(klass) {\ va_list args;\ char buf[BUFSIZ];\ \ @@ -350,7 +361,7 @@ Init_Exception() vsprintf(buf, fmt, args);\ va_end(args);\ \ - rb_raise(exc_new2(class, buf));\ + rb_raise(exc_new2(klass, buf));\ } void |