public Method

Exception.to_s

exception.to_s     string

Returns exception’s message (or the name of the exception if no message is set).

Source Code

/*
* call-seq:
*   exception.to_s   =>  string
*
* Returns exception's message (or the name of the exception if
* no message is set).
*/

static VALUE
exc_to_s(exc)
   VALUE exc;
{
   VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));

   if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
   if (OBJ_TAINTED(exc)) OBJ_TAINT(mesg);
   return mesg;
}
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.