method

throw

v1_9_1_378 - Show latest stable - Class: Kernel
throw(p1, p2 = v2)
public

Transfers control to the end of the active catch block waiting for tag. Raises ArgumentError 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.

1Note

To throw an exception, use Kernel#raise

tadman ยท Apr 21, 20093 thanks

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