From a3fa80847eca35ac59b97775ff037983d6c8493b Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 24 Feb 2016 17:09:30 +0800 Subject: [PATCH] Return 404 instead 500 when plugin is disabled. --- app/controllers/application_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index b36e02ccd84..ea15af17eea 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -94,7 +94,9 @@ class ApplicationController < ActionController::Base end end - rescue_from Discourse::NotFound do + class PluginDisabled < StandardError; end + + rescue_from Discourse::NotFound, PluginDisabled do rescue_discourse_actions(:not_found, 404) end @@ -120,8 +122,6 @@ class ApplicationController < ActionController::Base end end - class PluginDisabled < StandardError; end - # If a controller requires a plugin, it will raise an exception if that plugin is # disabled. This allows plugins to be disabled programatically. def self.requires_plugin(plugin_name)