summaryrefslogtreecommitdiffstats
path: root/parse.y
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-24 16:08:16 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-24 16:08:16 +0000
commit8866dba90dc7e496afa04605d31685e5cd07ce65 (patch)
treee59492a2d11090df6dae0e5bf65662a4cba5e650 /parse.y
parent7920f46e61a341772187eed8b906a6bb94715c61 (diff)
downloadruby-8866dba90dc7e496afa04605d31685e5cd07ce65.tar.gz
ruby-8866dba90dc7e496afa04605d31685e5cd07ce65.tar.xz
ruby-8866dba90dc7e496afa04605d31685e5cd07ce65.zip
merges r23837 from trunk into ruby_1_9_1.
-- * parse.y (parser_set_encode): show the erred file name instead of the file that requires it. [ruby-core:24006] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y14
1 files changed, 12 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 6596bf8af..735f31c2c 100644
--- a/parse.y
+++ b/parse.y
@@ -6113,13 +6113,23 @@ parser_set_encode(struct parser_params *parser, const char *name)
{
int idx = rb_enc_find_index(name);
rb_encoding *enc;
+ VALUE excargs[3];
if (idx < 0) {
- rb_raise(rb_eArgError, "unknown encoding name: %s", name);
+ VALUE rb_make_backtrace(void);
+ VALUE rb_make_exception(int, VALUE*);
+
+ excargs[1] = rb_sprintf("unknown encoding name: %s", name);
+ error:
+ excargs[0] = rb_eArgError;
+ excargs[2] = rb_make_backtrace();
+ rb_ary_unshift(excargs[2], rb_sprintf("%s:%d", ruby_sourcefile, ruby_sourceline));
+ rb_exc_raise(rb_make_exception(3, excargs));
}
enc = rb_enc_from_index(idx);
if (!rb_enc_asciicompat(enc)) {
- rb_raise(rb_eArgError, "%s is not ASCII compatible", rb_enc_name(enc));
+ excargs[1] = rb_sprintf("%s is not ASCII compatible", rb_enc_name(enc));
+ goto error;
}
parser->enc = enc;
}