Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
KeyError#key
() -> K?
key_error.key → object
error.c
View on GitHub ↗
static VALUE
key_err_key(VALUE self)
{
VALUE key;
key = rb_ivar_lookup(self, id_key, Qundef);
if (!UNDEF_P(key)) return key;
rb_raise(rb_eArgError, "no key is available");
}
Return the key caused this KeyError exception.