class method
self.failsafe_response
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3Signature
self.failsafe_response(fallback_output, status, originating_exception = nil)
If the block raises, send status code as a last-ditch response.
Parameters
-
fallback_outputreq -
statusreq -
originating_exceptionopt = nil
Source
# File actionpack/lib/action_controller/dispatcher.rb, line 59
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
Defined in actionpack/lib/action_controller/dispatcher.rb line 59
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Dispatcher