Could you do something like this?
begin do_something rescue => error if ENV["RACK_ENV"] == "test" raise error else handle_error error end end
This will cause the exception to be thrown again if you are not testing.
EDIT
As @Max points out, you can be a little more concise about this.
begin do_something rescue => error raise if ENV["RACK_ENV"] == "test" handle_error error end
source share