Ruby 2.4参考手册
错误 | Errors
UncaughtThrowError
Parent:ArgError
抛出时使用没有相应catch块的标签调用。
throw "foo", "bar"
引发了一个例外:
UncaughtThrowError: uncaught throw "foo"
公共类方法
new(*args) Show source
Document-class: UncaughtThrowError
抛出时使用没有相应catch块的标签调用。
throw "foo", "bar"
引发了一个例外:
UncaughtThrowError: uncaught throw "foo"
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;
}
公共实例方法
tag → obj Show source
返回被调用的标签对象。
static VALUE
uncaught_throw_tag(VALUE exc)
{
return rb_ivar_get(exc, id_tag);
}
to_s → string Show source
使用检查标签返回格式化邮件。
static VALUE
uncaught_throw_to_s(VALUE exc)
{
VALUE mesg = rb_attr_get(exc, id_mesg);
VALUE tag = uncaught_throw_tag(exc);
return rb_str_format(1, &tag, mesg);
}
value → obj Show source
返回被调用的返回值。
static VALUE
uncaught_throw_value(VALUE exc)
{
return rb_ivar_get(exc, id_value);
}
错误 | Errors相关

Ruby 是一种面向对象、命令式、函数式、动态的通用编程语言,是世界上最优美而巧妙的语言。
主页 | https://www.ruby-lang.org/ |
源码 | https://github.com/ruby/ruby |
版本 | 2.4 |
发布版本 | 2.4.1 |