X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FMisc%2FGeo.pm;h=bc020a22d403567ca1f329b856fa6e107ac3d22c;hp=96ce0764bc82a6bcfb9bd4380a8a79ca54a63fdd;hb=690d877102bcbddb20806995c549ed35b7b36647;hpb=4ee944740d805eb46be09f45a213f0c279c56d8c diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm index 96ce0764b..bc020a22d 100644 --- a/FS/FS/Misc/Geo.pm +++ b/FS/FS/Misc/Geo.pm @@ -147,7 +147,7 @@ sub get_district { Expects output of location_hash() as parameter -Dies on error, or if tax rate cannot be found using given address +Returns undef on error, or if tax rate cannot be found using given address Query the WA State Dept of Revenue API with an address, and return tax district information for that address. @@ -159,8 +159,8 @@ Lrollback on die() ... this will + # also roll back system log messages about errors :/ freeside-queued + # doesn't propgate die messages into the system log. + # + my $location_hash = shift; - # Return without die() when called with pointless context + # Return when called with pointless context return unless $location_hash && ref $location_hash @@ -227,8 +238,10 @@ sub wa_sales { my $error = sprintf "Problem parsing XML from API URL(%s): %s", $prepared_url, $@; + $log->error( $error ); - die $error; + warn $error; + return; } my ($res_root) = $dom->findnodes('/response'); @@ -255,8 +268,10 @@ sub wa_sales { $res_code ? $api_response_codes[$res_code] : 'n/a', $location_hash->{address1}, $prepared_url; + $log->error( $error ); - die "$error\n"; + warn "$error\n"; + return; } my %response = (