# File lib/rspec/core/example.rb, line 207 def set_exception(exception, context=nil) if @exception && context != :dont_print # 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 = "\nAn error occurred \#{context}\n\#{exception.class}: \#{exception.message}\noccurred at \#{exception.backtrace.first}\n\n" RSpec.configuration.reporter.message(msg) end @exception ||= exception end