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
commit7ea2ceddb832b9973694fecac9fe3c30400735ba (patch)
treea9b60dec20fa5f7f52ca7c8113195f2d65728a22 /error.c
parent62e41d3f2e48422bbdf1bb2db83ae60b255b1a1a (diff)
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
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 39e63dd..7163f62 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);