mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:32:42 +08:00
FIX: regression, missing 404 page
This commit is contained in:
@ -153,7 +153,7 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
rescue_from Discourse::NotFound, PluginDisabled do
|
rescue_from Discourse::NotFound, PluginDisabled, ActionController::RoutingError do
|
||||||
rescue_discourse_actions(:not_found, 404)
|
rescue_discourse_actions(:not_found, 404)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,12 +17,22 @@ module Middleware
|
|||||||
response = ActionDispatch::Response.new
|
response = ActionDispatch::Response.new
|
||||||
|
|
||||||
if exception
|
if exception
|
||||||
fake_controller = ApplicationController.new
|
begin
|
||||||
fake_controller.response = response
|
fake_controller = ApplicationController.new
|
||||||
|
fake_controller.response = response
|
||||||
|
fake_controller.request = ActionDispatch::Request.new(env)
|
||||||
|
|
||||||
if ApplicationController.rescue_with_handler(exception, object: fake_controller)
|
if ApplicationController.rescue_with_handler(exception, object: fake_controller)
|
||||||
return [response.status, response.headers, response.body]
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user