11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/log_sanity/middleware/routing_error_catcher.rb', line 11
def call(env)
request = ActionDispatch::Request.new env
_, , body = response = @app.call(env)
if ['X-Cascade'] == 'pass'
body.close if body.respond_to?(:close)
raise ActionController::RoutingError, "No route matches [#{env['REQUEST_METHOD']}] #{env['PATH_INFO'].inspect}"
end
response
rescue ActionController::RoutingError => exception
if request.show_exceptions?
render_exception(request, exception)
else
raise exception
end
end
|