From 278e4c6461df99d2ded53724f2b75a0fc677635d Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 20 Aug 2009 20:32:00 +0000 Subject: [PATCH] Log any errors found when calling Shop::Pay->getDrivers, instead of silently passing them along. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Shop/Pay.pm | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 1352860f7..fbbaca7a3 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -1,4 +1,5 @@ 7.7.18 + - fixed: Logging errors when getting the list of available driver classes. - fixed #10797: Unable to search for non-ASCII text - fixed #10800: Ogone payment driver typo - fixed #10799: Shop: Ogone payment driver- typo diff --git a/lib/WebGUI/Shop/Pay.pm b/lib/WebGUI/Shop/Pay.pm index 3d024dc3b..50dedb5d4 100644 --- a/lib/WebGUI/Shop/Pay.pm +++ b/lib/WebGUI/Shop/Pay.pm @@ -88,8 +88,13 @@ This subroutine returns a hash reference of available shipping driver classes as sub getDrivers { my $self = shift; my %drivers = (); - foreach my $class (@{$self->session->config->get('paymentDrivers')}) { - $drivers{$class} = eval { WebGUI::Pluggable::instanciate($class, 'getName', [ $self->session ])}; + CLASS: foreach my $class (@{$self->session->config->get('paymentDrivers')}) { + my $driverName = eval { WebGUI::Pluggable::instanciate($class, 'getName', [ $self->session ])}; + if ($@) { + $self->session->log->warn("Error loading $class: $@"); + } + next CLASS unless $driverName; + $drivers{$class} = $driverName; } return \%drivers; }