aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/re.c b/re.c
index 6a60a099fc..23196bb171 100644
--- a/re.c
+++ b/re.c
@@ -920,14 +920,16 @@ rb_reg_search(re, str, pos, reverse)
if (FL_TEST(re, KCODE_FIXED))
kcode_reset_option();
- if (result == -2) {
- rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len,
- "Stack overflow in regexp matcher", re);
- }
-
if (result < 0) {
- rb_backref_set(Qnil);
- return result;
+ if (result == ONIG_MISMATCH) {
+ rb_backref_set(Qnil);
+ return result;
+ }
+ else {
+ char err[ONIG_MAX_ERROR_MESSAGE_LEN];
+ re_error_code_to_str((UChar* )err, result);
+ rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len, err, 0);
+ }
}
match = rb_backref_get();