Method: Exception#initialize

Defined in:
error.c

#new(message = nil) ⇒ Exception

Returns a new exception object.

The given message should be a string-convertible object; see method #message; if not given, the message is the class name of the new instance (which may be the name of a subclass):

Examples:

Exception.new         # => #<Exception: Exception>
LoadError.new         # => #<LoadError: LoadError> # Subclass of Exception.
Exception.new('Boom') # => #<Exception: Boom>


1517
1518
1519
1520
1521
1522
1523
1524
# File 'error.c', line 1517

static VALUE
exc_initialize(int argc, VALUE *argv, VALUE exc)
{
    VALUE arg;

    arg = (!rb_check_arity(argc, 0, 1) ? Qnil : argv[0]);
    return exc_init(exc, arg);
}