2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: regression, missing 404 page

This commit is contained in:
Sam 2018-01-23 09:00:08 +11:00
parent 1e77850dff
commit 2437b0d531
2 changed files with 15 additions and 5 deletions

View file

@ -17,12 +17,22 @@ module Middleware
response = ActionDispatch::Response.new
if exception
fake_controller = ApplicationController.new
fake_controller.response = response
begin
fake_controller = ApplicationController.new
fake_controller.response = response
fake_controller.request = ActionDispatch::Request.new(env)
if ApplicationController.rescue_with_handler(exception, object: fake_controller)
return [response.status, response.headers, response.body]
if ApplicationController.rescue_with_handler(exception, object: fake_controller)
body = response.body
if String === body
body = [body]
end
return [response.status, response.headers, body]
end
rescue => e
Discourse.warn_exception(e, message: "Failed to handle exception in exception app middleware")
end
end
super
end