throw(p1, p2 = v2) public

Transfers control to the end of the active catch block waiting for tag. Raises UncaughtThrowError if there is no catch block for the tag. The optional second parameter supplies a return value for the catch block, which otherwise defaults to nil. For examples, see Kernel::catch.

Show source
Register or log in to add new notes.
April 21, 2009
3 thanks

To throw an exception, use Kernel#raise

Other languages use the term throw for raising exceptions, but Ruby has a specific raise call for that.