You can do this:
rescue => e
if Rails.env.test?
raise
else
puts "Error: #{ e } at: \n#{ e.backtrace.first }"
end
end
Pregunta
begin
...
rescue => e
puts "Error: #{ e } at: \n#{ e.backtrace.first }"
end
This works pretty well, but sometimes the error is reported to be in rack test. This makes it difficult to figure out where the error is coming from.
So, I would like to disable the rescue clause when running in the test environment.
Is this possible? Is there a better way to this?
Solución
You can do this:
rescue => e
if Rails.env.test?
raise
else
puts "Error: #{ e } at: \n#{ e.backtrace.first }"
end
end