From 7ea2ceddb832b9973694fecac9fe3c30400735ba Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 16 Jan 1998 12:19:22 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r11, which included commits to RCS files with non-trunk default branches. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'error.c') diff --git a/error.c b/error.c index 39e63ddfd5..7163f62609 100644 --- a/error.c +++ b/error.c @@ -102,7 +102,7 @@ Warning(fmt, va_alist) char buf[BUFSIZ]; va_list args; - if (!verbose) return; + if (!RTEST(verbose)) return; sprintf(buf, "warning: %s", fmt); @@ -225,11 +225,10 @@ exc_new2(etype, s) VALUE exc_new3(etype, str) - VALUE etype; - struct RString *str; + VALUE etype, str; { Check_Type(str, T_STRING); - return exc_new(etype, str->ptr, str->len); + return exc_new(etype, RSTRING(str)->ptr, RSTRING(str)->len); } static VALUE @@ -251,14 +250,20 @@ static VALUE exc_inspect(exc) VALUE exc; { - struct RString *classpath = RSTRING(rb_class_path(CLASS_OF(exc))); - VALUE str = str_new(classpath->ptr, classpath->len); + VALUE str, klass; - str_cat(str, ":", 1); + klass = CLASS_OF(exc); if (RSTRING(exc)->len == 0) { - str_cat(str, "\"\"", 2); + return rb_class_path(klass); } + + str = str_new2("#<"); + klass = rb_class_path(klass); + str_cat(str, RSTRING(klass)->ptr, RSTRING(klass)->len); + str_cat(str, ":", 1); str_cat(str, RSTRING(exc)->ptr, RSTRING(exc)->len); + str_cat(str, ">", 1); + return str; } @@ -285,7 +290,7 @@ exception(argc, argv) } } for (i=0; i