summaryrefslogtreecommitdiff
path: root/FS/FS/Misc
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2018-12-23 15:36:51 -0500
committerMitch Jackson <mitch@freeside.biz>2018-12-23 16:23:47 -0500
commit4b5e294d32ba1a2834f44f2dbcd42a276a0a75f1 (patch)
tree43129f78a4d5a305aaa8820e63170807c421331e /FS/FS/Misc
parent2189e5b3fcfc2e9dbba69824bedced93ada56991 (diff)
RT# 80488 Prevent rollback of system log messages
Diffstat (limited to 'FS/FS/Misc')
-rw-r--r--FS/FS/Misc/Geo.pm23
1 files changed, 19 insertions, 4 deletions
diff --git a/FS/FS/Misc/Geo.pm b/FS/FS/Misc/Geo.pm
index 96ce076..2e44364 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.
@@ -172,12 +172,23 @@ Returns a hashref with the following keys:
- country US
- exempt_amount 0
+If api returns no district for address, generates system log error
+and returns undef
+
=cut
sub wa_sales {
+
+ #
+ # no die():
+ # freeside-queued will issue dbh->rollback 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 = (