From: Mitch Jackson Date: Tue, 21 May 2019 17:42:16 +0000 (-0400) Subject: RT# 83401 Catch exception and display suitable error X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=7b90424db790634149932f49e253e4b33f8186a5 RT# 83401 Catch exception and display suitable error --- 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;