diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-24 06:02:33 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-24 06:02:33 +0000 |
commit | 609da4c2ec3f3982e21b3f07b064ac99b59dd80c (patch) | |
tree | 76ad47c1cf3e0c4a180d0aefc432837c3a5c541a | |
parent | 11f5073edf137f83e907a2b3311d36131fac291c (diff) | |
download | ruby-609da4c2ec3f3982e21b3f07b064ac99b59dd80c.tar.gz ruby-609da4c2ec3f3982e21b3f07b064ac99b59dd80c.tar.xz ruby-609da4c2ec3f3982e21b3f07b064ac99b59dd80c.zip |
* 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/trunk@23837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 14 |
2 files changed, 17 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Wed Jun 24 15:02:29 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (parser_set_encode): show the erred file name instead of + the file that requires it. [ruby-core:24006] + Wed Jun 24 11:41:20 2009 Akinori MUSHA <knu@iDaemons.org> * misc/ruby-style.el: It is too late to set c-file-style in @@ -6066,13 +6066,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; } |