diff options
author | Mitch Jackson <mitch@freeside.biz> | 2019-05-21 13:42:16 -0400 |
---|---|---|
committer | Mitch Jackson <mitch@freeside.biz> | 2019-05-21 16:12:36 -0400 |
commit | 7b90424db790634149932f49e253e4b33f8186a5 (patch) | |
tree | 54d3f0214abecc7ac6cf6d2bd75faf8457fa8861 /httemplate | |
parent | 7917cc1f73ef49554d05bc5039add533be725a3e (diff) |
RT# 83401 Catch exception and display suitable error
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/misc/process/payment.cgi | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 56bcfd872..5b18367f7 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -186,15 +186,22 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) { %saveopt = map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}}; } - my $error = $cust_main->save_cust_payby( - 'saved_cust_payby' => \$cust_payby, - 'payment_payby' => $payby, - 'auto' => scalar($cgi->param('auto')), - 'weight' => scalar($cgi->param('weight')), - 'payinfo' => $payinfo, - 'payname' => $payname, - %saveopt - ); + my $error; + { + local $@; + eval { + $error = $cust_main->save_cust_payby( + 'saved_cust_payby' => \$cust_payby, + 'payment_payby' => $payby, + 'auto' => scalar($cgi->param('auto')), + 'weight' => scalar($cgi->param('weight')), + 'payinfo' => $payinfo, + 'payname' => $payname, + %saveopt + ); + }; + $error ||= $@; + } errorpage("error saving info, payment not processed: $error") if $error; |