summaryrefslogtreecommitdiff
path: root/FS/FS/cust_credit.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-05-26 11:31:27 -0700
committerMark Wells <mark@freeside.biz>2015-05-26 11:31:48 -0700
commitaf62b675c3f1b8f5996561de7e6b28020479a7d6 (patch)
treeae975bc49fa45416a4e681e07de2a7ae0e7949b9 /FS/FS/cust_credit.pm
parent1da8bc3a1229d6e8fae3fde5ad70b297176c285b (diff)
throw an exception if Avalara is misconfigured, and clean up exception handling for tax engines in general, #25718, #31639
Diffstat (limited to 'FS/FS/cust_credit.pm')
-rw-r--r--FS/FS/cust_credit.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm
index 76fdecb..91bbf79 100644
--- a/FS/FS/cust_credit.pm
+++ b/FS/FS/cust_credit.pm
@@ -852,16 +852,16 @@ sub credit_lineitems {
foreach my $invnum ( sort { $a <=> $b } keys %cust_credit_bill ) {
- my $arrayref_or_error =
- $cust_main->calculate_taxes(
+ local $@;
+ my $arrayref_or_error = eval { $cust_main->calculate_taxes(
$cust_bill_pkg{$invnum}, # list of taxable items that we're crediting
$taxlisthash{$invnum}, # list of tax-item bindings
$cust_bill_pkg{$invnum}->[0]->cust_bill->_date, # invoice time
- );
+ ) };
- unless ( ref( $arrayref_or_error ) ) {
+ if ( $@ ) {
$dbh->rollback if $oldAutoCommit;
- return "Error calculating taxes: $arrayref_or_error";
+ return "Error calculating taxes: $@";
}
my %tax_links; # {tax billpkgnum}{nontax billpkgnum}