[Bug 20950] New: Plugins: Handler.pm doesn't fail gracefully when running plugin
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20950 Bug ID: 20950 Summary: Plugins: Handler.pm doesn't fail gracefully when running plugin Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: andrew.isherwood@ptfs-europe.com QA Contact: testopia@bugs.koha-community.org When running a plugin that fails for some internal reason, the user doesn't always receive a very helpful message. With the Kitchen Sink plugin ( https://github.com/bywatersolutions/koha-plugin-kitchen-sink ) I managed to break it by trying to import C4::Members::GetMember - which doesn't exist any more. Running the plugin in this broken state resulted in: run.pl: Plugin Koha::Plugin::Com::ByWaterSolutions::KitchenSink cannot be loaded at /usr/share/koha/Koha/Plugins/Handler.pm line 72.: /usr/share/koha/plugins/run.pl It turns out that Koha::Plugins::Handler::run calls Module::Load::Conditional::can_load, which was returning false, which caused the message I saw to be output. However, Module::Load::Conditional sets a global variable upon can_load returning false containing the reason. We should display this (assuming we don't consider it to be a security risk). So, in Handler.pm, we'd need to substitute in: if ( can_load( modules => { $plugin_class => undef } ) ) { my $plugin = $plugin_class->new( { cgi => $cgi, enable_plugins => $args->{'enable_plugins'} } ); if ( $plugin->can($plugin_method) ) { return $plugin->$plugin_method( $params ); } else { warn "Plugin does not have method $plugin_method"; } } else { warn "Plugin $plugin_class cannot be loaded: " . $Module::Load::Conditional::ERROR; } -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20950 Andrew Isherwood <andrew.isherwood@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20950 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de Component|Tools |Plugin architecture -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org