From 4bd98671bc183ffa97ef5ee5766fc52466399b2b Mon Sep 17 00:00:00 2001 From: Asmod4n Date: Thu, 17 Sep 2015 13:28:09 +0200 Subject: Problem: Hash#fetch doesn't raise KeyError when a key cannot be found Solution: change the Exception class raised to KeyError when a key cannot be found. --- mrbgems/mruby-hash-ext/mrblib/hash.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mrbgems/mruby-hash-ext/mrblib') diff --git a/mrbgems/mruby-hash-ext/mrblib/hash.rb b/mrbgems/mruby-hash-ext/mrblib/hash.rb index 5056d0720..ec8bd05fb 100644 --- a/mrbgems/mruby-hash-ext/mrblib/hash.rb +++ b/mrbgems/mruby-hash-ext/mrblib/hash.rb @@ -130,7 +130,7 @@ class Hash elsif none != NONE none else - raise RuntimeError, "Key not found: #{key}" + raise KeyError, "Key not found: #{key}" end else self[key] @@ -156,7 +156,7 @@ class Hash self.each do |k, v| self.delete(k) if block.call(k, v) - end + end self end -- cgit v1.2.3