Created
September 20, 2011 13:35
-
-
Save MrJaba/1229075 to your computer and use it in GitHub Desktop.
Fixing Local Request
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionDispatch | |
class Request < Rack::Request | |
def local? | |
false | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def render_exception(env, exception) | |
log_error(exception) | |
exception = original_exception(exception) | |
request = Request.new(env) | |
if @consider_all_requests_local || request.local? | |
rescue_action_locally(request, exception) | |
else | |
rescue_action_in_public(exception) | |
end | |
rescue Exception => failsafe_error | |
$stderr.puts "Error during failsafe response: #{failsafe_error}\n #{failsafe_error.backtrace * "\n "}" | |
FAILSAFE_RESPONSE | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment