summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-18 08:05:53 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-18 08:05:53 (GMT)
commit13f5dcb9f25cf07ef22baa5aded490395700b283 (patch)
tree5678b3e222c96077a2eb8e7a80e21dd5dbef1d3e /hash.c
parent2627c19d82252f2bb571f6bcb44e359cacefa92b (diff)
error.c: KeyError#receiver and KeyError#key
* error.c: new method KeyError#receiver and KeyError#key. [Feature #12063] * hash.c: make KeyError object with receiver and key. * sprintf.c: ditto. Author: ksss <co000ri@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index bc02696..7198e8a 100644
--- a/hash.c
+++ b/hash.c
@@ -912,7 +912,7 @@ rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash)
desc = rb_any_to_s(key);
}
desc = rb_str_ellipsize(desc, 65);
- rb_raise(rb_eKeyError, "key not found: %"PRIsVALUE, desc);
+ rb_key_err_raise(rb_sprintf("key not found: %"PRIsVALUE, desc), hash, key);
}
return argv[1];
}
@@ -3375,7 +3375,7 @@ env_fetch(int argc, VALUE *argv)
if (!env) {
if (block_given) return rb_yield(key);
if (argc == 1) {
- rb_raise(rb_eKeyError, "key not found: \"%"PRIsVALUE"\"", key);
+ rb_key_err_raise(rb_sprintf("key not found: \"%"PRIsVALUE"\"", key), envtbl, key);
}
return argv[1];
}