diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | parse.y | 14 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 18 insertions, 3 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] + Mon Jun 22 16:14:30 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * compile.c (iseq_set_arguments, iseq_compile_each): internal @@ -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; } @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.1" #define RUBY_RELEASE_DATE "2009-06-25" -#define RUBY_PATCHLEVEL 202 +#define RUBY_PATCHLEVEL 203 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 |