public Method

Exception.exception(...)

exc.exception(string)  an_exception or exc

With no argument, or if the argument is the same as the receiver, return the receiver. Otherwise, create a new exception object of the same class as the receiver, but with a message equal to string.to_str.

Source Code

/*
*  Document-method: exception
*
*  call-seq:
*     exc.exception(string) -> an_exception or exc
*  
*  With no argument, or if the argument is the same as the receiver,
*  return the receiver. Otherwise, create a new
*  exception object of the same class as the receiver, but with a
*  message equal to <code>string.to_str</code>.
*     
*/

static VALUE
exc_exception(argc, argv, self)
   int argc;
   VALUE *argv;
   VALUE self;
{
   VALUE exc;

   if (argc == 0) return self;
   if (argc == 1 && self == argv[0]) return self;
   exc = rb_obj_clone(self);
   exc_initialize(argc, argv, exc);

   return exc;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.