diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-02-18 01:56:47 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-02-18 01:56:47 +0000 |
commit | a9662810df18371af7492dd8298cc0cccc13c7c7 (patch) | |
tree | 5a1131ad0ca461f67177e1c7282eacc92356f864 /error.c | |
parent | 14aa2e8dda852b6b9277a8a7e16a78654edf1767 (diff) |
1.1b8pre1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@76 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -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++; } @@ -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 |