Return 404 instead 500 when plugin is disabled.
This commit is contained in:
parent
833af461ab
commit
a3fa80847e
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue