summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-01-16 12:19:22 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-01-16 12:19:22 +0000
commitfd1d8cdc09ed86e4a0812120a17ff0d7b04adcaf (patch)
tree341289a84a427f1e92425c7ebf82d2f1733e9a40 /error.c
parentf12baed5df6d3c213dd75d2f0d9f36bb179fb843 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/RUBY@11 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c25
1 files changed, 15 insertions, 10 deletions
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<argc; i++) {
- v = rb_define_class(rb_id2name(rb_to_id(argv[i])), eException);
+ v = rb_define_class_under(the_class, rb_id2name(rb_to_id(argv[i])), eException);
}
return v;
}
@@ -327,7 +332,7 @@ Init_Exception()
eNameError = rb_define_class("NameError", eException);
eIndexError = rb_define_class("IndexError", eException);
eNotImpError = rb_define_class("NotImplementError", eException);
- eLoadError = rb_define_class("LoadError", eException);
+ eLoadError = rb_define_class("LoadError", eException);
eRuntimeError = rb_define_class("RuntimeError", eException);
eSecurityError = rb_define_class("SecurityError", eException);