From 3060c7438d99e23ee0f2e35275dce45d4684d9be Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 11 Dec 2008 04:40:08 +0000 Subject: [PATCH] * re.c (reg_enc_error): raise EncodingCompatibilityError for encoding incompatibility. [ruby-core:18600] * re.c (rb_reg_prepare_enc): more consistent error message. [ruby-core:18611] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ re.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 881c73ebea..e1bf3bc26a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Dec 11 13:09:01 2008 Yukihiro Matsumoto + + * re.c (reg_enc_error): raise EncodingCompatibilityError for + encoding incompatibility. [ruby-core:18600] + + * re.c (rb_reg_prepare_enc): more consistent error message. + [ruby-core:18611] + Thu Dec 11 13:36:18 2008 Nobuyoshi Nakada * encoding.c (enc_set_default_encoding): allowed to set default diff --git a/re.c b/re.c index a45ae47d9f..5ef1c7c49b 100644 --- a/re.c +++ b/re.c @@ -1168,7 +1168,7 @@ rb_reg_preprocess(const char *p, const char *end, rb_encoding *enc, static void reg_enc_error(VALUE re, VALUE str) { - rb_raise(rb_eArgError, + rb_raise(rb_eEncCompatError, "incompatible encoding regexp match (%s regexp with %s string)", rb_enc_name(RREGEXP(re)->ptr->enc), rb_enc_name(rb_enc_get(str))); @@ -1181,7 +1181,7 @@ rb_reg_prepare_enc(VALUE re, VALUE str, int warn) if (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) { rb_raise(rb_eArgError, - "broken %s string", + "invalid byte sequence in %s", rb_enc_name(rb_enc_get(str))); }