Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2.2.1) is shown here.
failsafe_response(fallback_output, status, originating_exception = nil)
public
If the block raises, send status code as a last-ditch response.
# File actionpack/lib/action_controller/dispatcher.rb, line 57
def failsafe_response(fallback_output, status, originating_exception = nil)
yield
rescue Exception => exception
begin
log_failsafe_exception(status, originating_exception || exception)
body = failsafe_response_body(status)
fallback_output.write "Status: #{status}\r\nContent-Type: text/html\r\n\r\n#{body}"
nil
rescue Exception => failsafe_error # Logger or IO errors
$stderr.puts "Error during failsafe response: #{failsafe_error}"
$stderr.puts "(originally #{originating_exception})" if originating_exception
end
end