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"

Class Methods


Construct a new KeyError exception with the given message, receiver and key.

Instance Methods


Return the key caused this KeyError exception.

Return the receiver associated with this KeyError exception.