Return 404 instead 500 when plugin is disabled.

This commit is contained in:
Guo Xiang Tan 2016-02-24 17:09:30 +08:00
parent 833af461ab
commit a3fa80847e
1 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,9 @@ class ApplicationController < ActionController::Base
end end
end end
rescue_from Discourse::NotFound do class PluginDisabled < StandardError; end
rescue_from Discourse::NotFound, PluginDisabled do
rescue_discourse_actions(:not_found, 404) rescue_discourse_actions(:not_found, 404)
end end
@ -120,8 +122,6 @@ class ApplicationController < ActionController::Base
end end
end end
class PluginDisabled < StandardError; end
# If a controller requires a plugin, it will raise an exception if that plugin is # If a controller requires a plugin, it will raise an exception if that plugin is
# disabled. This allows plugins to be disabled programatically. # disabled. This allows plugins to be disabled programatically.
def self.requires_plugin(plugin_name) def self.requires_plugin(plugin_name)