class

KeyError

Inherits Exception / Reference / Object

Raised when the specified key is not found.

h = {"foo" => "bar"}
h["baz"] # raises KeyError (Missing hash key: "baz")