method

throw

v1_8_7_330 - Show latest stable - Class: Kernel
throw(...)
public

Transfers control to the end of the active catch block waiting for symbol. Raises NameError if there is no catch block for the symbol. 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.