Exception: UncaughtThrowError
- Inherits:
-
ArgumentError
- Object
- Exception
- StandardError
- ArgumentError
- UncaughtThrowError
- Defined in:
- vm_eval.c,
vm_eval.c
Overview
Raised when throw
is called with a tag which does not have corresponding catch
block.
throw "foo", "bar"
raises the exception:
UncaughtThrowError: uncaught throw "foo"
Instance Method Summary collapse
-
#initialize(*args) ⇒ Object
constructor
Raised when
throw
is called with a tag which does not have correspondingcatch
block. -
#tag ⇒ Object
Return the tag object which was called for.
-
#to_s ⇒ String
Returns formatted message with the inspected tag.
-
#value ⇒ Object
Return the return value which was called for.
Methods inherited from Exception
#==, #backtrace, #backtrace_locations, #cause, #exception, exception, #full_message, #inspect, #message, #set_backtrace, to_tty?
Constructor Details
#initialize(*args) ⇒ Object
Raised when throw
is called with a tag which does not have corresponding catch
block.
throw "foo", "bar"
raises the exception:
UncaughtThrowError: uncaught throw "foo"
2119 2120 2121 2122 2123 2124 2125 2126 2127 |
# File 'vm_eval.c', line 2119
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;
}
|
Instance Method Details
#tag ⇒ Object
Return the tag object which was called for.
2136 2137 2138 2139 2140 |
# File 'vm_eval.c', line 2136
static VALUE
uncaught_throw_tag(VALUE exc)
{
return rb_ivar_get(exc, id_tag);
}
|
#to_s ⇒ String
Returns formatted message with the inspected tag.
2162 2163 2164 2165 2166 2167 2168 |
# File 'vm_eval.c', line 2162
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 ⇒ Object
Return the return value which was called for.
2149 2150 2151 2152 2153 |
# File 'vm_eval.c', line 2149
static VALUE
uncaught_throw_value(VALUE exc)
{
return rb_ivar_get(exc, id_value);
}
|