class RSpec::Core::Example

def set_exception(exception, context=nil)

Other tags:
    Private: -
def set_exception(exception, context=nil)
  if pending? && !(Pending::PendingExampleFixedError === exception)
    execution_result.pending_exception = exception
  else
    if @exception
      # An error has already been set; we don't want to override it,
      # but we also don't want silence the error, so let's print it.
      msg = <<-EOS
rror occurred #{context}
exception.class}: #{exception.message}
curred at #{exception.backtrace.first}
      EOS
      RSpec.configuration.reporter.message(msg)
    end
    @exception ||= exception
  end
end