End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Exception#cause
exception.cause → an_exception or nil
error.c
View on GitHub ↗
static VALUE
exc_cause(VALUE exc)
{
return rb_attr_get(exc, id_cause);
}
Returns the previous exception ($!) at the time this exception was raised. This is useful for wrapping exceptions and retaining the original exception information.
See also
#backtrace_locations
#exception
#backtrace
#full_message
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1