public Method

Exception.to_str

exception.message     string
exception.to_str      string

Returns the result of invoking exception.to_s. Normally this returns the exception’s message or name. By supplying a to_str method, exceptions are agreeing to be used where Strings are expected.

Source Code

/*
* call-seq:
*   exception.message   =>  string
*   exception.to_str    =>  string
*
* Returns the result of invoking <code>exception.to_s</code>.
* Normally this returns the exception's message or name. By
* supplying a to_str method, exceptions are agreeing to
* be used where Strings are expected.
*/

static VALUE
exc_to_str(exc)
   VALUE exc;
{
   return rb_funcall(exc, rb_intern("to_s"), 0, 0);
}
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.