class KeyError - Ruby 2.2.4 Core API Reference API Reference
From Ruby 2.2 Core API
class KeyError
Raised when the specified key is not found. It is a subclass of IndexError.
h = {"foo" => :bar} h.fetch("foo") #=> :bar h.fetch("baz") #=> KeyError: key not found: "baz"