summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-20 01:51:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-20 01:51:32 +0000
commit7f425b216b18f44489c46cadcc7186ba4f04cbb7 (patch)
treeaa56137f881b95134afd3005e857d13e16f53be5 /eval.c
parent340e5082e23d731695a6156e5259caa3ded77b4c (diff)
* eval.c (rb_f_missing): create exception instance by ordinal
method. * error.c (rb_name_error, rb_sys_fail): ditto. * error.c (exc_to_s, exit_status, name_err_name, nometh_err_args, syserr_errno, syserr_eqq): access attributes. * error.c (name_err_initialize, nometh_err_initialize, syserr_initialize): initialize attributes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/eval.c b/eval.c
index 0bc1fea016..d497bb4409 100644
--- a/eval.c
+++ b/eval.c
@@ -4599,13 +4599,18 @@ rb_f_missing(argc, argv, obj)
{
char buf[BUFSIZ];
int noclass = (!d || desc[0]=='#');
+ int n = 0;
+ VALUE args[3];
snprintf(buf, BUFSIZ, format, rb_id2name(id),
desc, noclass ? "" : ":",
noclass ? "" : rb_obj_classname(obj));
- exc = rb_exc_new2(exc, buf);
- rb_iv_set(exc, "name", argv[0]);
- rb_iv_set(exc, "args", rb_ary_new4(argc-1, argv+1));
+ args[n++] = rb_str_new2(buf);
+ args[n++] = argv[0];
+ if (exc == rb_eNoMethodError) {
+ args[n++] = rb_ary_new4(argc-1, argv+1);
+ }
+ exc = rb_class_new_instance(n, args, exc);
rb_exc_raise(exc);
}
POP_FRAME();