Patch #31030

Include plugin name in the exception when the plugin required by requires_redmine_plugin is not found

Added by Jérôme BATAILLE 9 days ago. Updated 8 days ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Plugin API
Target version:4.0.3

Description

The exception is :

lib/redmine/plugin.rb:141:in `find': Redmine::PluginNotFound (Redmine::PluginNotFound)

It would be better if it is :

lib/redmine/plugin.rb:273:in `rescue in requires_redmine_plugin': redmine_smile_enhancements plugin requires plugin redmine_smile_base (Redmine::PluginNotFound)

RM_dependant_plugin_missing_exception_svn.diff Magnifier (603 Bytes) Jérôme BATAILLE, 2019-03-14 16:05

Associated revisions

Revision 17960
Added by Jean-Philippe Lang 8 days ago

Include plugin name in the exception when the plugin required by requires_redmine_plugin is not found (#31030).

Patch by Jérôme BATAILLE and Go MAEDA.

Revision 17961
Added by Jean-Philippe Lang 8 days ago

Merged r17960 to 4.0-stable (#31030).

Revision 17966
Added by Jean-Philippe Lang 8 days ago

PluginRequirementError is now raised instead of PluginNotFound (#31030).

Revision 17967
Added by Jean-Philippe Lang 8 days ago

Merged r17966 to 4.0-stable (#31030).

History

#1 Updated by Jérôme BATAILLE 9 days ago

Here is the patch.

#2 Updated by Go MAEDA 8 days ago

  • Category changed from Core Plugins to Plugin API
  • Target version set to Candidate for next minor release

I think it should catch only PluginNotFound exception.

diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb
index ec575d17a..16e266da1 100644
--- a/lib/redmine/plugin.rb
+++ b/lib/redmine/plugin.rb
@@ -270,7 +270,11 @@ module Redmine
       arg = { :version_or_higher => arg } unless arg.is_a?(Hash)
       arg.assert_valid_keys(:version, :version_or_higher)

-      plugin = Plugin.find(plugin_name)
+      begin
+        plugin = Plugin.find(plugin_name)
+      rescue PluginNotFound
+        raise PluginRequirementError.new("#{id} plugin requires the #{plugin_name} plugin")
+      end
       current = plugin.version.split('.').collect(&:to_i)

       arg.each do |k, v|

#3 Updated by Go MAEDA 8 days ago

  • Target version changed from Candidate for next minor release to 4.0.3

Setting the target version to 4.0.3.

#4 Updated by Go MAEDA 8 days ago

  • Subject changed from Missing dependant plugin : give missing plugin name in exception to Include plugin name in the exception when the plugin required by requires_redmine_plugin is not found

#5 Updated by Jean-Philippe Lang 8 days ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang

Committed, thanks.

Also available in: Atom PDF