Method: Fiber#raise

Defined in:
cont.c

#raiseObject #raise(string) ⇒ Object #raise(exception[, string [, array]]) ⇒ Object

Raises an exception in the fiber at the point at which the last Fiber.yield was called. If the fiber has not been started or has already run to completion, raises FiberError. If the fiber is yielding, it is resumed. If it is transferring, it is transferred into. But if it is resuming, raises FiberError.

With no arguments, raises a RuntimeError. With a single String argument, raises a RuntimeError with the string as a message. Otherwise, the first parameter should be the name of an Exception class (or an object that returns an Exception object when sent an exception message). The optional second parameter sets the message associated with the exception, and the third parameter is an array of callback information. Exceptions are caught by the rescue clause of begin...end blocks.

Raises FiberError if called on a Fiber belonging to another Thread.

See Kernel#raise for more information.

Overloads:



3193
3194
3195
3196
3197
# File 'cont.c', line 3193

static VALUE
rb_fiber_m_raise(int argc, VALUE *argv, VALUE self)
{
    return rb_fiber_raise(self, argc, argv);
}