I have several controllers in my Ruby on Rails applications with a save handler at the end of the action, which basically catches any unhandled errors and returns some kind of user-friendly error. However, when I do a rake test, I would like to disable these emergency handlers by default so that I can see the full error and stack trace. Is there any automated way to do this?
Refresh to clarify: I have an action like this:
def foo
rescue
render :text => "Exception: #{$!}"
end
Now, when I check the functionality, if an exception occurs, I'm going to get some information about the exception, but I would like it to act as if there was no rescue agent, so I get full debugging information.
Update: SOLUTION
I have done this:
rescue:
raise unless Rails.env.production?
render :text => "Exception: #{$!}"
end
source
share