diff options
author | Ivan Kohler <ivan@freeside.biz> | 2014-09-06 14:47:03 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2014-09-06 14:47:03 -0700 |
commit | 464cbc7302c2c77aba5317c15d8753942b5e8dd4 (patch) | |
tree | 3267ee613bae5f01be1f2be13a8510bdfa7f6a1b | |
parent | b6cbedaae251e2b32af21fa6078446713e599ba9 (diff) |
better error page when re-emailing bad addresses or other SMTP errorsm, RT#25834
-rw-r--r-- | httemplate/misc/send-invoice.cgi | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/httemplate/misc/send-invoice.cgi b/httemplate/misc/send-invoice.cgi index 08dd0e01c..dd9c3ade2 100644 --- a/httemplate/misc/send-invoice.cgi +++ b/httemplate/misc/send-invoice.cgi @@ -1,4 +1,8 @@ +% if ( $error ) { +% errorpage($error); +% } else { <% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %> +% } <%once> my %method = ( map { $_=>1 } qw( email print fax_invoice ) ); @@ -26,9 +30,13 @@ my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum}); die "Can't find invoice!\n" unless $cust_bill; $cust_bill->set('mode' => $mode) if $mode; -$cust_bill->$method({ 'template' => $template, - 'notice_name' => $notice_name, - }); + +#these methods die instead of return errors, so, handle that without a backtrace +eval { $cust_bill->$method({ 'template' => $template, + 'notice_name' => $notice_name, + }); + }; +my $error = $@; my $custnum = $cust_bill->getfield('custnum'); |