[freeside-commits] freeside/FS/FS geocode_Mixin.pm, 1.8.2.1, 1.8.2.2
Ivan,,,
ivan at wavetail.420.am
Wed Dec 21 13:19:12 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv18719
Modified Files:
Tag: FREESIDE_2_3_BRANCH
geocode_Mixin.pm
Log Message:
eval fatal geocoding errors, turn them into warnings, RT#15539
Index: geocode_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/geocode_Mixin.pm,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -u -w -d -r1.8.2.1 -r1.8.2.2
--- geocode_Mixin.pm 13 Dec 2011 05:10:22 -0000 1.8.2.1
+++ geocode_Mixin.pm 21 Dec 2011 21:19:10 -0000 1.8.2.2
@@ -143,15 +143,20 @@
#my $module = FS::Conf->new->config('geocode_module') || 'Geo::Coder::Googlev3';
my $geocoder = Geo::Coder::Googlev3->new;
- my $location = $geocoder->geocode( location =>
+
+ my $location = eval {
+ $geocoder->geocode( location =>
$self->get($pre.'address1'). ','.
( $self->get($pre.'address2') ? $self->get($pre.'address2').',' : '' ).
$self->get($pre.'city'). ','.
$self->get($pre.'state'). ','.
code2country($self->get($pre.'country'))
);
-
- #errors?
+ };
+ if ( $@ ) {
+ warn "geocoding error: $@\n";
+ return;
+ }
my $geo_loc = $location->{'geometry'}{'location'} or return;
if ( $geo_loc->{'lat'} && $geo_loc->{'lng'} ) {
More information about the freeside-commits
mailing list