Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
UncaughtThrowError.new
(untyped tag, untyped value) -> ::UncaughtThrowError
new(*args)
vm_eval.c
View on GitHub ↗
static VALUE
uncaught_throw_init(int argc, const VALUE *argv, VALUE exc)
{
rb_check_arity(argc, 2, UNLIMITED_ARGUMENTS);
rb_call_super(argc - 2, argv + 2);
rb_ivar_set(exc, id_tag, argv[0]);
rb_ivar_set(exc, id_value, argv[1]);
return exc;
}
Document-class: UncaughtThrowError
Raised when throw is called with a tag which does not have corresponding catch block.
Example
throw "foo", "bar"
raises the exception:
UncaughtThrowError: uncaught throw "foo"