Skip to content

Instantly share code, notes, and snippets.

@MrJaba
Created September 20, 2011 13:35
Show Gist options
  • Save MrJaba/1229075 to your computer and use it in GitHub Desktop.
Save MrJaba/1229075 to your computer and use it in GitHub Desktop.
Fixing Local Request
module ActionDispatch
class Request < Rack::Request
def local?
false
end
end
end
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