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:22:26 -0400 |
| commit | 788f8cf0e36811291a9ce0e1cfab833caa4c4cf5 (patch) | |
| tree | e1d858e674f240993765696dfb30a15e5d209663 | |
| parent | 844bc4bed7f3f301181371b0a2fcc2a2dfab7db0 (diff) | |
RT# 83401 Catch exception and display suitable error
| -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; |
